javax.swing.JLayer Java Examples
The following examples show how to use
javax.swing.JLayer.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: SpotlightLayerUI.java From mars-sim with GNU General Public License v3.0 | 5 votes |
@Override protected void processMouseMotionEvent(MouseEvent e, JLayer l) { Point p = SwingUtilities.convertPoint(e.getComponent(), e.getPoint(), l); mX = p.x; mY = p.y; l.repaint(); }
Example #2
Source File: ProductSceneViewTopComponent.java From snap-desktop with GNU General Public License v3.0 | 5 votes |
public ProductSceneViewTopComponent(ProductSceneView view, UndoRedo undoRedo) { super(view.getRaster()); this.view = view; this.undoRedo = undoRedo != null ? undoRedo : UndoRedo.NONE; this.nodeRenameHandler = new NodeRenameHandler(); this.selection = Selection.EMPTY; setToolTipText(view.getRaster().getDescription()); setIcon(ImageUtilities.loadImage("org/esa/snap/rcp/icons/RsBandAsSwath.gif")); updateDisplayName(); setName(getDisplayName()); /* // checkme - this is ugly and not wanted (nf), the node will either passed in or we'll have // a central node factory, e.g. via an ExtensionObject Node node = null; try { if (raster instanceof Mask) { node = new MNode((Mask) raster, undoRedo); } else if (raster instanceof Band) { node = new BNode((Band) raster, undoRedo); } else if (raster instanceof TiePointGrid) { node = new TPGNode((TiePointGrid) raster, undoRedo); } } catch (IntrospectionException e) { Exceptions.printStackTrace(e); } if (node != null) { setActivatedNodes(new Node[]{node}); } */ setLayout(new BorderLayout()); add(new JLayer<>(this.view, new ProductSceneViewLayerUI()), BorderLayout.CENTER); }
Example #3
Source File: FieldValidationLayerUI.java From quickfix-messenger with BSD 3-Clause "New" or "Revised" License | 5 votes |
@Override public void paint(Graphics g, JComponent c) { super.paint(g, c); JLayer<?> jlayer = (JLayer<?>) c; JFormattedTextField jFormattedTextField = (JFormattedTextField) jlayer .getView(); if (jFormattedTextField.getFormatterFactory() != null && !jFormattedTextField.isEditValid()) { Graphics2D g2 = (Graphics2D) g.create(); // Paint a red X g2.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON); int w = c.getWidth(); int h = c.getHeight(); // int pad = 4; int s = 10; int pad = 10; int x = w - pad - s; int y = (h - s) / 2; ImageIcon icon = IconBuilder .build(frame.getMessenger().getConfig(), IconBuilder.INVALID_FIELD); g2.drawImage(icon.getImage(), x, y, null); g2.dispose(); } }
Example #4
Source File: WaitLayerUI.java From mars-sim with GNU General Public License v3.0 | 5 votes |
@Override public void installUI(JComponent c) { super.installUI(c); ((JLayer)c).setLayerEventMask( AWTEvent.MOUSE_EVENT_MASK | AWTEvent.MOUSE_MOTION_EVENT_MASK | AWTEvent.MOUSE_WHEEL_EVENT_MASK | AWTEvent.KEY_EVENT_MASK | AWTEvent.FOCUS_EVENT_MASK | AWTEvent.COMPONENT_EVENT_MASK); }
Example #5
Source File: SpotlightLayerUI.java From mars-sim with GNU General Public License v3.0 | 5 votes |
@Override public void installUI(JComponent c) { super.installUI(c); JLayer<?> jlayer = (JLayer<?>)c; jlayer.setLayerEventMask( AWTEvent.MOUSE_EVENT_MASK | AWTEvent.MOUSE_MOTION_EVENT_MASK ); }
Example #6
Source File: LoadingPanel.java From mars-sim with GNU General Public License v3.0 | 5 votes |
public LoadingPanel() { JPanel panel = new JPanel() { @Override public Dimension getPreferredSize() { return new Dimension(400, 300); } }; JLayer<JPanel> jlayer = new JLayer<>(panel, layerUI); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); frame.add(jlayer); frame.pack(); frame.setVisible(true); layerUI.start(); }
Example #7
Source File: CardCellRenderer.java From rapidminer-studio with GNU Affero General Public License v3.0 | 5 votes |
/** * Creates a {@link CardCellRenderer} that is used by lists containing {@link Card}s. */ public CardCellRenderer() { setVerticalTextPosition(SwingConstants.BOTTOM); setHorizontalTextPosition(SwingConstants.CENTER); setHorizontalAlignment(CENTER); setOpaque(false); layer = new JLayer<>(this, new CardLayerUI()); }
Example #8
Source File: SpotlightLayerUI.java From mars-sim with GNU General Public License v3.0 | 4 votes |
@Override protected void processMouseEvent(MouseEvent e, JLayer l) { if (e.getID() == MouseEvent.MOUSE_ENTERED) mActive = true; if (e.getID() == MouseEvent.MOUSE_EXITED) mActive = false; }
Example #9
Source File: FlatThemeEditorPane.java From FlatLaf with Apache License 2.0 | 4 votes |
FlatThemeEditorPane() { super( new BorderLayout() ); // register FlatLaf token maker AbstractTokenMakerFactory tmf = (AbstractTokenMakerFactory) TokenMakerFactory.getDefaultInstance(); tmf.putMapping( FLATLAF_STYLE, FlatThemeTokenMaker.class.getName() ); // create text area textArea = new FlatSyntaxTextArea(); textArea.setSyntaxEditingStyle( FLATLAF_STYLE ); textArea.setMarkOccurrences( true ); textArea.addParser( new FlatThemeParser() ); // textArea.setUseColorOfColorTokens( true ); // theme try { Theme theme = Theme.load( getClass().getResourceAsStream( "light.xml" ) ); theme.apply( textArea ); } catch( IOException ex ) { ex.printStackTrace(); } // use semitransparent token background because token background // is painted over mark occurrences background SyntaxScheme scheme = textArea.getSyntaxScheme(); scheme.getStyle( FlatThemeTokenMaker.TOKEN_COLOR ).background = new Color( 0x0a000000, true ); scheme.getStyle( FlatThemeTokenMaker.TOKEN_VARIABLE ).background = new Color( 0x1800cc00, true ); // create overlay layer JLayer<FlatSyntaxTextArea> overlay = new JLayer<>( textArea, new FlatThemeEditorOverlay() ); // create scroll pane scrollPane = new RTextScrollPane( overlay ); scrollPane.setLineNumbersEnabled( true ); // scale fonts if( UIScale.getUserScaleFactor() != 1 ) textArea.setFont( scaleFont( textArea.getFont() ) ); // use same font for line numbers as in editor scrollPane.getGutter().setLineNumberFont( textArea.getFont() ); add( scrollPane, BorderLayout.CENTER ); }
Example #10
Source File: TableWaitLayer.java From mars-sim with GNU General Public License v3.0 | 4 votes |
public JComponent makeUI() { startButton.setAction(new AbstractAction("start") { @Override public void actionPerformed(ActionEvent e) { layerUI.start(); startButton.setEnabled(false); SwingWorker<String, Object[]> worker = new SwingWorker<String, Object[]>() { @Override public String doInBackground() { int current = 0, lengthOfTask = 120; while (current < lengthOfTask && !isCancelled()) { try { Thread.sleep(50); } catch (InterruptedException ie) { return "Interrupted"; } publish(new Object[] { "aaa", current++, false }); } return "Done"; } @Override protected void process(java.util.List<Object[]> chunks) { for (Object[] array : chunks) { model.addRow(array); } table.scrollRectToVisible(table.getCellRect(model.getRowCount() - 1, 0, true)); } @Override public void done() { layerUI.stop(); startButton.setEnabled(true); String text = null; if (isCancelled()) { text = "Cancelled"; } else { try { text = get(); } catch (Exception ex) { ex.printStackTrace(); text = "Exception"; } } } }; worker.execute(); } }); JPanel p = new JPanel(new BorderLayout()); p.add(new JButton("dummy"), BorderLayout.NORTH); p.add(new JLayer<JComponent>(new JScrollPane(table), layerUI)); p.add(startButton, BorderLayout.SOUTH); return p; }
Example #11
Source File: SettlementWindow.java From mars-sim with GNU General Public License v3.0 | 4 votes |
/** * Constructor. * * @param desktop the main desktop panel. */ public SettlementWindow(MainDesktopPane desktop) { // Use ToolWindow constructor super(NAME, desktop); this.desktop = desktop; if (marsClock == null) marsClock = Simulation.instance().getMasterClock().getMarsClock(); // // setTitleName(null); // // Remove title bar // putClientProperty("JInternalFrame.isPalette", Boolean.TRUE); // getRootPane().setWindowDecorationStyle(JRootPane.NONE); // BasicInternalFrameUI bi = (BasicInternalFrameUI) super.getUI(); // bi.setNorthPane(null); // setBorder(null); setDefaultCloseOperation(WindowConstants.HIDE_ON_CLOSE); // getRootPane().setOpaque(false); // getRootPane().setBackground(new Color(0,0,0,128)); setBackground(Color.BLACK); // setOpaque(false); // setBackground(new Color(0,0,0,128)); WebPanel mainPanel = new WebPanel(new BorderLayout()); // mainPanel.setOpaque(false); // mainPanel.setBackground(new Color(0,0,0,128)); setContentPane(mainPanel); // Creates the status bar for showing the x/y coordinates and population statusBar = new WebStatusBar();//JStatusBar(3, 3, 18); mainPanel.add(statusBar, BorderLayout.SOUTH); Font font = new Font("Times New Roman", Font.BOLD, 12); popLabel = new WebStyledLabel(StyleId.styledlabelShadow); popLabel.setFont(font); popLabel.setForeground(Color.GRAY); buildingXYLabel = new WebStyledLabel(StyleId.styledlabelShadow); buildingXYLabel.setFont(font); buildingXYLabel.setForeground(Color.GRAY); mapXYLabel = new WebStyledLabel(StyleId.styledlabelShadow); mapXYLabel.setFont(font); mapXYLabel.setForeground(Color.GRAY); // statusBar.addLeftComponent(mapXYLabel, false); // statusBar.addCenterComponent(popLabel, false); // statusBar.addRightComponent(buildingXYLabel, false); // statusBar.addRightCorner(); statusBar.add(mapXYLabel); statusBar.addToMiddle(popLabel); statusBar.addToEnd(buildingXYLabel); // statusBar.addRightCorner(); // Create subPanel for housing the settlement map subPanel = new WebPanel(new BorderLayout()); mainPanel.add(subPanel, BorderLayout.CENTER); // subPanel.setOpaque(false); // subPanel.setBackground(new Color(0,0,0,128)); subPanel.setBackground(Color.BLACK); mapPanel = new SettlementMapPanel(desktop, this); mapPanel.createUI(); // Added SpotlightLayerUI LayerUI<WebPanel> layerUI = new SpotlightLayerUI(mapPanel); JLayer<WebPanel> jlayer = new JLayer<WebPanel>(mapPanel, layerUI); subPanel.add(jlayer, BorderLayout.CENTER); // subPanel.add(mapPanel, BorderLayout.CENTER); setSize(new Dimension(HORIZONTAL, VERTICAL)); setPreferredSize(new Dimension(HORIZONTAL, VERTICAL)); setMinimumSize(new Dimension(HORIZONTAL / 2, VERTICAL / 2)); setClosable(true); setResizable(false); setMaximizable(true); setVisible(true); pack(); }
Example #12
Source File: WaitLayerUI.java From mars-sim with GNU General Public License v3.0 | 4 votes |
@Override public void applyPropertyChange(PropertyChangeEvent pce, JLayer<? extends JComponent> l) { if ("tick".equals(pce.getPropertyName())) { l.repaint(); } }
Example #13
Source File: ConfigurableDialog.java From rapidminer-studio with GNU Affero General Public License v3.0 | 4 votes |
/** * Updates the parameter panel for the selected {@link Configurable}. */ private void updateParameterPanel(Configurable config) { parameterPanel.removeAll(); // save previously edited parameters updateModel(); if (config != null) { try { // stripped text depending on the size of the panel String text = SwingTools.getStrippedJComponentText(outerPanel, config.getName(), outerPanel.getWidth() - 100, 0); nameLabel.setText("<html><b>" + text + "</b></html>"); // Get parameters based on Configurator implementation Parameters parameters = ConfigurationManager.getInstance().getAbstractConfigurator(config.getTypeId()) .getParameterHandler(config).getParameters(); // fill in real values of configurable for (String key : config.getParameters().keySet()) { parameters.setParameter(key, config.getParameters().get(key)); } // init param panel with real values configParamPanel = new ConfiguratorParameterPanel(this, parameters); parameterLayer = new JLayer<JPanel>(configParamPanel); parameterLayer.setGlassPane(simpleGlassPane); simpleGlassPane.setVisible(false); // add it to wrapper panel parameterPanel.add(parameterLayer, BorderLayout.CENTER); boolean editingAllowed = true; boolean editingPossible = true; if (config.getSource() != null) { if (config.getSource().isConnected()) { if (!remoteControllers.get(config.getSource().getName()).getModel().hasAdminRights()) { editingAllowed = false; } // only interesting if we want to edit remote connections editingPossible = remoteControllers.get(config.getSource().getName()).getModel().isEditingPossible(); } } if (!editingPossible) { SwingTools.setEnabledRecursive(configParamPanel, false); simpleGlassPane.setVisible(true); } else { if (!editingAllowed) { SwingTools.setEnabledRecursive(configParamPanel, false); simpleGlassPane.setVisible(true); renameButton.setVisible(false); removeButton.setVisible(false); actionPanel.setVisible(false); } else { if (!configParamPanel.isEnabled()) { SwingTools.setEnabledRecursive(configParamPanel, true); } if (simpleGlassPane.isVisible()) { simpleGlassPane.setVisible(false); } // make editing components visible renameButton.setVisible(true); removeButton.setVisible(true); actionPanel.setVisible(true); } } } catch (Exception e) { LogService.getRoot().log(Level.WARNING, "com.rapidminer.tools.config.gui.ConfigurableDialog.error_setting_parameters", e); // display error in GUI parameterPanel.removeAll(); JLabel errorLabel = new JLabel( I18N.getGUIMessage(I18N .getGUIMessage("gui.dialog.configurable_dialog.error.display_stored_configurable.label")), FAILURE_ICON, SwingConstants.LEADING); errorLabel.setHorizontalAlignment(SwingConstants.CENTER); parameterPanel.add(errorLabel, BorderLayout.CENTER); } } updateButtonState(true); parameterPanel.revalidate(); parameterPanel.repaint(); }
Example #14
Source File: WaitLayerUI.java From mars-sim with GNU General Public License v3.0 | 4 votes |
@Override public void uninstallUI(JComponent c) { ((JLayer)c).setLayerEventMask(0); super.uninstallUI(c); }
Example #15
Source File: WaitLayerUI.java From mars-sim with GNU General Public License v3.0 | 4 votes |
public void eventDispatched(AWTEvent e, JLayer<? extends JComponent> l) { if(mIsRunning && e instanceof InputEvent) { ((InputEvent)e).consume(); } }
Example #16
Source File: WaitLayerUIPanel.java From mars-sim with GNU General Public License v3.0 | 4 votes |
@Override public void applyPropertyChange(PropertyChangeEvent pce, JLayer l) { if ("tick".equals(pce.getPropertyName())) { l.repaint(); } }
Example #17
Source File: GroupPanel.java From quickfix-messenger with BSD 3-Clause "New" or "Revised" License | 4 votes |
private void initComponents() { setLayout(new GridBagLayout()); layerUI = new FieldValidationLayerUI(getFrame()); groupLabel = new JLabel(getMember().toString()); groupLabel.setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR)); groupLabel.addMouseListener(new LinkMouseAdapter(this)); groupLabel.setToolTipText("Double-click to look-up in FIXwiki"); if (isRequired) { groupLabel.setForeground(Color.BLUE); } JPanel groupValuePanel = new JPanel(); groupValuePanel.setLayout(new BoxLayout(groupValuePanel, BoxLayout.X_AXIS)); groupTextField = new JFormattedTextField( NumberFormat.getIntegerInstance()); groupTextField.setFocusLostBehavior(JFormattedTextField.COMMIT); if (initialNoOfGroups > 0) { groupTextField.setText(String.valueOf(initialNoOfGroups)); } setButton = new JButton("Set"); setButton.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { getFrame().displayMainPanel(); } }); groupValuePanel.add(new JLayer<JFormattedTextField>(groupTextField, layerUI)); groupValuePanel.add(setButton); groupPanels = new JPanel(); groupPanels.setLayout(new GridBagLayout()); loadMembers(); add(groupLabel, createGridBagConstraints()); add(groupValuePanel, createGridBagConstraints()); add(groupPanels, createGridBagConstraints()); }
Example #18
Source File: ConfigurableDialog.java From rapidminer-studio with GNU Affero General Public License v3.0 | 4 votes |
/** * Initializes the GUI. */ private void initGUI() { realOuterPanel = new JPanel(new BorderLayout()); outerLayer = new JLayer<JPanel>(realOuterPanel); savingGlassPane = new TransparentGlassPanePanel(WAITING_ICON, I18N.getGUILabel("configurable_dialog.saving_configurables"), getBackground(), 0.5f); outerLayer.setGlassPane(savingGlassPane); savingGlassPane.setVisible(false); JPanel pagePanel = new JPanel(new BorderLayout()); // list of configurables JPanel configPanel = createConfigPanel(); // force size so it does not resize itself depending on entered values configPanel.setMinimumSize(CONFIG_LIST_SIZE); configPanel.setMaximumSize(CONFIG_LIST_SIZE); configPanel.setPreferredSize(CONFIG_LIST_SIZE); buttonPanel = createConfigurableButtonPanel(); // create middle spacer JLabel spacer = new JLabel(); spacer.setMinimumSize(DIMENSION_SPACER_MIDDLE); spacer.setMaximumSize(DIMENSION_SPACER_MIDDLE); spacer.setPreferredSize(DIMENSION_SPACER_MIDDLE); // add both to an outer panel for layout reasons JPanel outerConfigPanel = new JPanel(new BorderLayout()); outerConfigPanel.setBorder(BorderFactory.createMatteBorder(0, 1, 1, 1, Color.LIGHT_GRAY)); outerConfigPanel.add(configPanel, BorderLayout.CENTER); outerConfigPanel.add(buttonPanel, BorderLayout.SOUTH); // another panel for layouting JPanel outermostConfigPanel = new JPanel(new BorderLayout()); outermostConfigPanel.add(outerConfigPanel, BorderLayout.CENTER); outermostConfigPanel.add(spacer, BorderLayout.EAST); // glass pane showed if the user is not able to edit connections due to an old version of // the server simpleGlassPane = new TransparentGlassPanePanel(null, null, getBackground(), 0.5f); // panel displaying the selected configurable JPanel paramPanel = createParameterPanel(); GridBagConstraints c = new GridBagConstraints(); c.fill = GridBagConstraints.BOTH; c.weightx = 1; c.weighty = 0.3; c.gridwidth = GridBagConstraints.REMAINDER; // add panels to page panel pagePanel.add(outermostConfigPanel, BorderLayout.WEST); pagePanel.add(paramPanel, BorderLayout.CENTER); // add page and button panel to outer panel realOuterPanel.add(pagePanel, BorderLayout.CENTER); layoutDefault(outerLayer, makeSaveButton(), makeCancel()); new DeprecationWarning("manage_configurables").addToDialog(this); setDefaultSize(ButtonDialog.HUGE); setLocationRelativeTo(ApplicationFrame.getApplicationFrame()); setModal(true); setDefaultCloseOperation(DO_NOTHING_ON_CLOSE); addWindowListener(new WindowAdapter() { @Override public void windowClosing(WindowEvent e) { cancelButton.doClick(); } }); updateButtonState(true); }
Example #19
Source File: HtmlPreviewElement.java From netbeans with Apache License 2.0 | 4 votes |
@Override protected void processMouseEvent( MouseEvent e, JLayer<? extends JPanel> panel ) { super.processMouseEvent( e, panel ); if( e.getButton() == MouseEvent.BUTTON1 ) e.consume(); }
Example #20
Source File: SpotlightLayerUI.java From mars-sim with GNU General Public License v3.0 | 3 votes |
@Override public void uninstallUI(JComponent c) { JLayer<?> jlayer = (JLayer<?>)c; jlayer.setLayerEventMask(0); super.uninstallUI(c); }
Example #21
Source File: PerspectivesPanelBar.java From rapidminer-studio with GNU Affero General Public License v3.0 | 2 votes |
/** * Factory to create a perspectives panel bar which is covered by a JLayer. * * @param perspectives * @return */ @SuppressWarnings("deprecation") public static final JLayer<JPanel> getPerspecitvesPanelBar(Perspectives perspectives) { PerspectivesPanelBar view = new PerspectivesPanelBar(perspectives); return new JLayer<>(view, new PerspectivesLayerUI(view)); }