Java Code Examples for javax.swing.JComponent
The following examples show how to use
javax.swing.JComponent. These examples are extracted from open source projects.
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 Project: knopflerfish.org Source File: DefaultSwingBundleDisplayer.java License: BSD 3-Clause "New" or "Revised" License | 6 votes |
@Override public void valueChanged(long bid) { boolean bHasVisible = false; for (final JComponent comp : components) { if (comp.isShowing()) { bHasVisible = true; break; } } lastBID = bid; if (bHasVisible) { valueChangedLazy(bid); } }
Example 2
Source Project: seaglass Source File: SeaGlassTextFieldUI.java License: Apache License 2.0 | 6 votes |
/** * {@inheritDoc} */ @Override public void mouseMoved(MouseEvent e) { currentMouseX = e.getX(); currentMouseY = e.getY(); Cursor cursorToUse = Cursor.getPredefinedCursor(Cursor.TEXT_CURSOR); if (isOverCancelButton() || isOverFindButton()) { cursorToUse = Cursor.getDefaultCursor(); } JComponent c = (JComponent) e.getSource(); if (!cursorToUse.equals(c.getCursor())) { c.setCursor(cursorToUse); } super.mouseMoved(e); }
Example 3
Source Project: netbeans Source File: ProgressHandleFactoryTest.java License: Apache License 2.0 | 6 votes |
@RandomlyFails // NB-Core-Build #1176 public void testCustomComponentIsInitialized() { Controller.defaultInstance = new TestController(); ProgressHandle handle = ProgressHandleFactory.createHandle("task 1"); // Warning, this will make the handle to work with a new Controller, not TestController. JComponent component = ProgressHandleFactory.createProgressComponent(handle); handle.start(15); handle.progress(2); waitForTimerFinish(); assertEquals(15, ((JProgressBar) component).getMaximum()); assertEquals(2, ((JProgressBar) component).getValue()); handle = ProgressHandleFactory.createHandle("task 2"); component = ProgressHandleFactory.createProgressComponent(handle); handle.start(20); waitForTimerFinish(); assertEquals(20, ((JProgressBar) component).getMaximum()); assertEquals(0, ((JProgressBar) component).getValue()); }
Example 4
Source Project: netbeans Source File: ToolsAction.java License: Apache License 2.0 | 6 votes |
@NbBundle.Messages({ "LAB_ToolsActionInitializing=Initializing..." }) @Override public JComponent[] synchMenuPresenters(JComponent[] items) { G g = gl(50); if (g == null) { JMenuItem init = new JMenuItem(); init.setText(Bundle.LAB_ToolsActionInitializing()); init.setEnabled(false); return new JMenuItem[] { init }; } if (timestamp == g.getTimestamp()) { return items; } // generate directly list of menu items List<JMenuItem> l = generate(toolsAction, true); timestamp = gl().getTimestamp(); return l.toArray(new JMenuItem[l.size()]); }
Example 5
Source Project: ghidra Source File: DockingWindowManagerTest.java License: Apache License 2.0 | 6 votes |
private void assertStacked(DockingWindowManager dwm, ComponentProvider... providers) { Integer x = null; Integer y = null; for (ComponentProvider p : providers) { ComponentPlaceholder ph = dwm.getActivePlaceholder(p); ComponentNode n = ph.getNode(); JComponent c = n.getComponent(); Point l = c.getLocationOnScreen(); if (x == null) { x = l.x; y = l.y; } else { assertEquals("Providers are not stacked together", x.intValue(), l.x); assertEquals("Providers are not stacked together", y.intValue(), l.y); } } }
Example 6
Source Project: brModelo Source File: MostradorDeCodigo.java License: GNU General Public License v3.0 | 6 votes |
public MostradorDeCodigo(java.awt.Frame parent, boolean modal) { super(parent, modal); initComponents(); lblHtml = new JLabel(); scrPrincipal.getViewport().add(lblHtml); //dbModel.InicieAnsi2011(); getRootPane().registerKeyboardAction(e -> { //this.dispose(); //setResultado(JOptionPane.CANCEL_OPTION); setVisible(false); }, KeyStroke.getKeyStroke(KeyEvent.VK_ESCAPE, 0), JComponent.WHEN_IN_FOCUSED_WINDOW); getRootPane().registerKeyboardAction(e -> { //setResultado(JOptionPane.OK_OPTION); setVisible(false); }, KeyStroke.getKeyStroke(KeyEvent.VK_ENTER, java.awt.event.InputEvent.CTRL_DOWN_MASK), JComponent.WHEN_IN_FOCUSED_WINDOW); getRootPane().registerKeyboardAction(e -> { btnCopyActionPerformed(null); }, KeyStroke.getKeyStroke(KeyEvent.VK_C, java.awt.event.InputEvent.CTRL_DOWN_MASK), JComponent.WHEN_IN_FOCUSED_WINDOW); setTitle(Editor.fromConfiguracao.getValor("Controler.interface.Titulo.MostradorDeCodigo")); this.pack(); }
Example 7
Source Project: MtgDesktopCompanion Source File: CardTransfertHandler.java License: GNU General Public License v3.0 | 5 votes |
@Override public int getSourceActions(JComponent c) { DisplayableCard p = (DisplayableCard) c; Point pt = p.getLocation(); SwingUtilities.convertPointToScreen(pt, p); dragLab.setIcon(p.toIcon()); window.setLocation(pt); return MOVE; }
Example 8
Source Project: jmeter-plugins Source File: IntegerInputVerifier.java License: Apache License 2.0 | 5 votes |
/** * Verifies the input with the side effect that the background color of {@code input} to {@code background} if * returns {@code true}, or {@code warningBackground} otherwise * * @param input component * @return if input is valid */ public boolean shouldYieldFocus(JComponent input) { boolean isValidInput = verify(input); if (isValidInput) { input.setBackground(background); } else { input.setBackground(warningBackground); } return isValidInput; }
Example 9
Source Project: TencentKona-8 Source File: MultiFileChooserUI.java License: GNU General Public License v2.0 | 5 votes |
/** * Invokes the <code>getAccessibleChildrenCount</code> method on each UI handled by this object. * * @return the value obtained from the first UI, which is * the UI obtained from the default <code>LookAndFeel</code> */ public int getAccessibleChildrenCount(JComponent a) { int returnValue = ((ComponentUI) (uis.elementAt(0))).getAccessibleChildrenCount(a); for (int i = 1; i < uis.size(); i++) { ((ComponentUI) (uis.elementAt(i))).getAccessibleChildrenCount(a); } return returnValue; }
Example 10
Source Project: rapidminer-studio Source File: EditableTableHeader.java License: GNU Affero General Public License v3.0 | 5 votes |
@SuppressWarnings("deprecation") public Component prepareEditor(TableCellEditor editor, int index) { Object value = columnModel.getColumn(index).getHeaderValue(); boolean isSelected = true; int row = HEADER_ROW; JTable table = getTable(); Component comp = editor.getTableCellEditorComponent(table, value, isSelected, row, index); if (comp instanceof JComponent) { ((JComponent) comp).setNextFocusableComponent(this); } return comp; }
Example 11
Source Project: rapidminer-studio Source File: ExampleVisualizer.java License: GNU Affero General Public License v3.0 | 5 votes |
protected JComponent makeMainVisualizationComponent(Example example) { JComponent main; String[] columnNames = new String[] { "Attribute", "Value" }; String[][] data = new String[exampleSet.getAttributes().allSize()][2]; Iterator<Attribute> a = exampleSet.getAttributes().allAttributes(); int counter = 0; while (a.hasNext()) { Attribute attribute = a.next(); data[counter][0] = attribute.getName(); data[counter][1] = getFormattedValue(example, attribute); counter++; } ExtendedJTable table = new ExtendedJTable(); table.setDefaultEditor(Object.class, null); TableModel tableModel = new DefaultTableModel(data, columnNames); table.setRowHighlighting(true); table.setRowHeight(PropertyPanel.VALUE_CELL_EDITOR_HEIGHT); table.setModel(tableModel); main = new ExtendedJScrollPane(table); main.setBorder(null); int tableHeight = (int) (table.getPreferredSize().getHeight() + table.getTableHeader().getPreferredSize().getHeight() + 5); // 5 for border if (tableHeight < main.getPreferredSize().getHeight()) { main.setPreferredSize(new Dimension((int) main.getPreferredSize().getWidth(), tableHeight)); } return main; }
Example 12
Source Project: openjdk-jdk8u Source File: MultiSeparatorUI.java License: GNU General Public License v2.0 | 5 votes |
/** * Invokes the <code>getAccessibleChild</code> method on each UI handled by this object. * * @return the value obtained from the first UI, which is * the UI obtained from the default <code>LookAndFeel</code> */ public Accessible getAccessibleChild(JComponent a, int b) { Accessible returnValue = ((ComponentUI) (uis.elementAt(0))).getAccessibleChild(a,b); for (int i = 1; i < uis.size(); i++) { ((ComponentUI) (uis.elementAt(i))).getAccessibleChild(a,b); } return returnValue; }
Example 13
Source Project: LGoodDatePicker Source File: FormLayout.java License: MIT License | 5 votes |
private static void invalidateAndRepaint(Container container) { if (container == null) { return; } if (container instanceof JComponent) { ((JComponent) container).revalidate(); } else { container.invalidate(); } container.repaint(); }
Example 14
Source Project: jdk8u-jdk Source File: MultiProgressBarUI.java License: GNU General Public License v2.0 | 5 votes |
/** * Returns a multiplexing UI instance if any of the auxiliary * <code>LookAndFeel</code>s supports this UI. Otherwise, just returns the * UI object obtained from the default <code>LookAndFeel</code>. */ public static ComponentUI createUI(JComponent a) { ComponentUI mui = new MultiProgressBarUI(); return MultiLookAndFeel.createUIs(mui, ((MultiProgressBarUI) mui).uis, a); }
Example 15
Source Project: netbeans Source File: OnSaveTabPanelController.java License: Apache License 2.0 | 5 votes |
@Override public JComponent getComponent(Lookup masterLookup) { if (panel == null) { panel = new OnSaveTabPanel(); } return panel; }
Example 16
Source Project: Java8CN Source File: MultiSeparatorUI.java License: Apache License 2.0 | 5 votes |
/** * Invokes the <code>contains</code> method on each UI handled by this object. * * @return the value obtained from the first UI, which is * the UI obtained from the default <code>LookAndFeel</code> */ public boolean contains(JComponent a, int b, int c) { boolean returnValue = ((ComponentUI) (uis.elementAt(0))).contains(a,b,c); for (int i = 1; i < uis.size(); i++) { ((ComponentUI) (uis.elementAt(i))).contains(a,b,c); } return returnValue; }
Example 17
Source Project: openjdk-jdk9 Source File: MultiOptionPaneUI.java License: GNU General Public License v2.0 | 5 votes |
/** * Invokes the <code>contains</code> method on each UI handled by this object. * * @return the value obtained from the first UI, which is * the UI obtained from the default <code>LookAndFeel</code> */ public boolean contains(JComponent a, int b, int c) { boolean returnValue = uis.elementAt(0).contains(a,b,c); for (int i = 1; i < uis.size(); i++) { uis.elementAt(i).contains(a,b,c); } return returnValue; }
Example 18
Source Project: openjdk-8 Source File: MultiDesktopIconUI.java License: GNU General Public License v2.0 | 5 votes |
/** * Invokes the <code>getAccessibleChildrenCount</code> method on each UI handled by this object. * * @return the value obtained from the first UI, which is * the UI obtained from the default <code>LookAndFeel</code> */ public int getAccessibleChildrenCount(JComponent a) { int returnValue = ((ComponentUI) (uis.elementAt(0))).getAccessibleChildrenCount(a); for (int i = 1; i < uis.size(); i++) { ((ComponentUI) (uis.elementAt(i))).getAccessibleChildrenCount(a); } return returnValue; }
Example 19
Source Project: jdk8u-jdk Source File: MultiTabbedPaneUI.java License: GNU General Public License v2.0 | 5 votes |
/** * Invokes the <code>getMinimumSize</code> method on each UI handled by this object. * * @return the value obtained from the first UI, which is * the UI obtained from the default <code>LookAndFeel</code> */ public Dimension getMinimumSize(JComponent a) { Dimension returnValue = ((ComponentUI) (uis.elementAt(0))).getMinimumSize(a); for (int i = 1; i < uis.size(); i++) { ((ComponentUI) (uis.elementAt(i))).getMinimumSize(a); } return returnValue; }
Example 20
Source Project: WorldGrower Source File: ChooseKnowledgeAction.java License: GNU General Public License v3.0 | 5 votes |
public ChooseKnowledgeAction(WorldObject playerCharacter, ImageInfoReader imageInfoReader, SoundIdReader soundIdReader, World world, JComponent parent, ActionContainingArgs guiAction, JFrame parentFrame) { super(); this.playerCharacter = playerCharacter; this.imageInfoReader = imageInfoReader; this.soundIdReader = soundIdReader; this.world = world; this.parent = parent; this.guiAction = guiAction; this.parentFrame = parentFrame; }
Example 21
Source Project: openjdk-jdk9 Source File: MultiSliderUI.java License: GNU General Public License v2.0 | 5 votes |
/** * Invokes the <code>getMinimumSize</code> method on each UI handled by this object. * * @return the value obtained from the first UI, which is * the UI obtained from the default <code>LookAndFeel</code> */ public Dimension getMinimumSize(JComponent a) { Dimension returnValue = uis.elementAt(0).getMinimumSize(a); for (int i = 1; i < uis.size(); i++) { uis.elementAt(i).getMinimumSize(a); } return returnValue; }
Example 22
Source Project: jdk8u-dev-jdk Source File: SlidingSpinner.java License: GNU General Public License v2.0 | 5 votes |
SlidingSpinner(ColorPanel panel, JComponent label) { this.panel = panel; this.label = label; this.slider.addChangeListener(this); this.spinner.addChangeListener(this); DefaultEditor editor = (DefaultEditor) this.spinner.getEditor(); ValueFormatter.init(3, false, editor.getTextField()); editor.setFocusable(false); this.spinner.setFocusable(false); }
Example 23
Source Project: openjdk-jdk8u-backup Source File: MultiTableUI.java License: GNU General Public License v2.0 | 5 votes |
/** * Returns a multiplexing UI instance if any of the auxiliary * <code>LookAndFeel</code>s supports this UI. Otherwise, just returns the * UI object obtained from the default <code>LookAndFeel</code>. */ public static ComponentUI createUI(JComponent a) { ComponentUI mui = new MultiTableUI(); return MultiLookAndFeel.createUIs(mui, ((MultiTableUI) mui).uis, a); }
Example 24
Source Project: dragonwell8_jdk Source File: MultiSliderUI.java License: GNU General Public License v2.0 | 5 votes |
/** * Invokes the <code>getMinimumSize</code> method on each UI handled by this object. * * @return the value obtained from the first UI, which is * the UI obtained from the default <code>LookAndFeel</code> */ public Dimension getMinimumSize(JComponent a) { Dimension returnValue = ((ComponentUI) (uis.elementAt(0))).getMinimumSize(a); for (int i = 1; i < uis.size(); i++) { ((ComponentUI) (uis.elementAt(i))).getMinimumSize(a); } return returnValue; }
Example 25
Source Project: netbeans Source File: ClasspathCategoryProvider.java License: Apache License 2.0 | 5 votes |
public JComponent createComponent(Category category, Lookup context) { Project project = context.lookup(Project.class); ProjectAccessor acc = context.lookup(ProjectAccessor.class); AuxiliaryConfiguration aux = context.lookup(AuxiliaryConfiguration.class); assert aux != null; assert acc != null; assert project != null; final JdkConfiguration jdkConf = new JdkConfiguration(project, acc.getHelper(), acc.getEvaluator()); final ClasspathPanel panel = new ClasspathPanel(jdkConf); final JavaPlatform initialPlatform = (JavaPlatform) panel.javaPlatform.getSelectedItem(); ProjectModel pm = context.lookup(ProjectModel.class); assert pm != null; panel.setModel(pm); pm.addChangeListener(new ChangeListener() { public void stateChanged(ChangeEvent arg0) { panel.updateControls(); } }); category.setOkButtonListener(new ActionListener() { public void actionPerformed(ActionEvent arg0) { JavaPlatform p = (JavaPlatform) panel.javaPlatform.getSelectedItem(); if (p != initialPlatform) { try { jdkConf.setSelectedPlatform(p); } catch (IOException x) { ErrorManager.getDefault().notify(ErrorManager.INFORMATIONAL, x); } } } }); return panel; }
Example 26
Source Project: openjdk-8-source Source File: MultiFileChooserUI.java License: GNU General Public License v2.0 | 5 votes |
/** * Returns a multiplexing UI instance if any of the auxiliary * <code>LookAndFeel</code>s supports this UI. Otherwise, just returns the * UI object obtained from the default <code>LookAndFeel</code>. */ public static ComponentUI createUI(JComponent a) { ComponentUI mui = new MultiFileChooserUI(); return MultiLookAndFeel.createUIs(mui, ((MultiFileChooserUI) mui).uis, a); }
Example 27
Source Project: Rails Source File: HexHighlightMouseListener.java License: GNU General Public License v2.0 | 5 votes |
/** * @param pf Portfolio which is dynamically evaluated at mouse-even-time for * any contained private companies */ public static void addMouseListener(JComponent c,ORUIManager orUIManager,PortfolioModel pf) { if (isEnabled(false)) { HexHighlightMouseListener l = new HexHighlightMouseListener(orUIManager); l.portfolio = pf; c.addMouseListener(l); } }
Example 28
Source Project: netbeans Source File: AbstractDesignEditor.java License: Apache License 2.0 | 5 votes |
/** * Used to get the JComponent used for the structure pane. Usually a container for the structure component or the structure component itself. * @return the JComponent */ public JComponent getStructureView(){ if (structureView ==null){ structureView = createStructureComponent(); structureView.addPropertyChangeListener(new NodeSelectedListener()); } return structureView; }
Example 29
Source Project: netbeans Source File: Utils.java License: Apache License 2.0 | 5 votes |
public static void hideLabelAndLabelFor(JComponent component, String lab) { JLabel label = findLabel(component, lab); if(label != null) { label.setVisible(false); Component c = label.getLabelFor(); if(c != null) { c.setVisible(false); } } }
Example 30
Source Project: TencentKona-8 Source File: NimbusLookAndFeel.java License: GNU General Public License v2.0 | 5 votes |
/** Called by UIManager when this look and feel is installed. */ @Override public void initialize() { super.initialize(); defaults.initialize(); // create synth style factory setStyleFactory(new SynthStyleFactory() { @Override public SynthStyle getStyle(JComponent c, Region r) { return defaults.getStyle(c, r); } }); }