Java Code Examples for javax.swing.JPanel#setEnabled()
The following examples show how to use
javax.swing.JPanel#setEnabled() .
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: MainUI.java From Simple-ADB with GNU General Public License v3.0 | 6 votes |
/** * to disable the passed panel and all it's components */ private void freezePanel(JPanel panel, boolean condition) { panel.setEnabled(!condition); Component[] com = panel.getComponents(); for (int i = 0; i < com.length; i++) { if (!abortBtn.isEnabled()) if (com[i] instanceof JTextField) { ((JTextField) com[i]).setText(""); com[i].requestFocus(); } if (!com[i].equals(combo)) com[i].setEnabled(!condition); else if (!commandRadio.isSelected()) com[i].setEnabled(!condition); } }
Example 2
Source File: CursorOverlappedPanelsTest.java From TencentKona-8 with GNU General Public License v2.0 | 5 votes |
private static JPanel createPanel(Point location, boolean enabled) { final JPanel panel = new JPanel(); panel.setOpaque(false); panel.setEnabled(enabled); panel.setSize(new Dimension(200, 200)); panel.setLocation(location); panel.setBorder(BorderFactory.createTitledBorder( enabled ? "Enabled" : "Disabled")); panel.setCursor(Cursor.getPredefinedCursor( enabled ? Cursor.CROSSHAIR_CURSOR : Cursor.DEFAULT_CURSOR)); System.out.println("cursor: " + Cursor.getPredefinedCursor(enabled ? Cursor.CROSSHAIR_CURSOR : Cursor.DEFAULT_CURSOR)); return panel; }
Example 3
Source File: CursorOverlappedPanelsTest.java From jdk8u-dev-jdk with GNU General Public License v2.0 | 5 votes |
private static JPanel createPanel(Point location, boolean enabled) { final JPanel panel = new JPanel(); panel.setOpaque(false); panel.setEnabled(enabled); panel.setSize(new Dimension(200, 200)); panel.setLocation(location); panel.setBorder(BorderFactory.createTitledBorder( enabled ? "Enabled" : "Disabled")); panel.setCursor(Cursor.getPredefinedCursor( enabled ? Cursor.CROSSHAIR_CURSOR : Cursor.DEFAULT_CURSOR)); System.out.println("cursor: " + Cursor.getPredefinedCursor(enabled ? Cursor.CROSSHAIR_CURSOR : Cursor.DEFAULT_CURSOR)); return panel; }
Example 4
Source File: CursorOverlappedPanelsTest.java From jdk8u-jdk with GNU General Public License v2.0 | 5 votes |
private static JPanel createPanel(Point location, boolean enabled) { final JPanel panel = new JPanel(); panel.setOpaque(false); panel.setEnabled(enabled); panel.setSize(new Dimension(200, 200)); panel.setLocation(location); panel.setBorder(BorderFactory.createTitledBorder( enabled ? "Enabled" : "Disabled")); panel.setCursor(Cursor.getPredefinedCursor( enabled ? Cursor.CROSSHAIR_CURSOR : Cursor.DEFAULT_CURSOR)); System.out.println("cursor: " + Cursor.getPredefinedCursor(enabled ? Cursor.CROSSHAIR_CURSOR : Cursor.DEFAULT_CURSOR)); return panel; }
Example 5
Source File: CursorOverlappedPanelsTest.java From jdk8u_jdk with GNU General Public License v2.0 | 5 votes |
private static JPanel createPanel(Point location, boolean enabled) { final JPanel panel = new JPanel(); panel.setOpaque(false); panel.setEnabled(enabled); panel.setSize(new Dimension(200, 200)); panel.setLocation(location); panel.setBorder(BorderFactory.createTitledBorder( enabled ? "Enabled" : "Disabled")); panel.setCursor(Cursor.getPredefinedCursor( enabled ? Cursor.CROSSHAIR_CURSOR : Cursor.DEFAULT_CURSOR)); System.out.println("cursor: " + Cursor.getPredefinedCursor(enabled ? Cursor.CROSSHAIR_CURSOR : Cursor.DEFAULT_CURSOR)); return panel; }
Example 6
Source File: CursorOverlappedPanelsTest.java From openjdk-8 with GNU General Public License v2.0 | 5 votes |
private static JPanel createPanel(Point location, boolean enabled) { final JPanel panel = new JPanel(); panel.setOpaque(false); panel.setEnabled(enabled); panel.setSize(new Dimension(200, 200)); panel.setLocation(location); panel.setBorder(BorderFactory.createTitledBorder( enabled ? "Enabled" : "Disabled")); panel.setCursor(Cursor.getPredefinedCursor( enabled ? Cursor.CROSSHAIR_CURSOR : Cursor.DEFAULT_CURSOR)); System.out.println("cursor: " + Cursor.getPredefinedCursor(enabled ? Cursor.CROSSHAIR_CURSOR : Cursor.DEFAULT_CURSOR)); return panel; }
Example 7
Source File: DocValuesDialogFactory.java From lucene-solr with Apache License 2.0 | 5 votes |
private JPanel headerPanel() { JPanel header = new JPanel(); header.setOpaque(false); header.setLayout(new BoxLayout(header, BoxLayout.PAGE_AXIS)); JPanel fieldHeader = new JPanel(new FlowLayout(FlowLayout.LEADING, 3, 3)); fieldHeader.setOpaque(false); fieldHeader.add(new JLabel(MessageUtils.getLocalizedMessage("documents.docvalues.label.doc_values"))); fieldHeader.add(new JLabel(field)); header.add(fieldHeader); JPanel typeHeader = new JPanel(new FlowLayout(FlowLayout.LEADING, 3, 3)); typeHeader.setOpaque(false); typeHeader.add(new JLabel(MessageUtils.getLocalizedMessage("documents.docvalues.label.type"))); typeHeader.add(new JLabel(docValues.getDvType().toString())); header.add(typeHeader); JPanel decodeHeader = new JPanel(new FlowLayout(FlowLayout.TRAILING, 3, 3)); decodeHeader.setOpaque(false); decodeHeader.add(new JLabel("decoded as")); String[] decoders = Arrays.stream(Decoder.values()).map(Decoder::toString).toArray(String[]::new); decodersCombo.setModel(new DefaultComboBoxModel<>(decoders)); decodersCombo.setSelectedItem(Decoder.LONG.toString()); decodersCombo.addActionListener(listeners::selectDecoder); decodeHeader.add(decodersCombo); if (docValues.getValues().size() > 0) { decodeHeader.setEnabled(false); } header.add(decodeHeader); return header; }
Example 8
Source File: DetailsProvider.java From visualvm with GNU General Public License v2.0 | 5 votes |
private static JComponent initialView() { JLabel loading = new JLabel(Bundle.BrowserUtils_Loading(), JLabel.CENTER); loading.setEnabled(false); JPanel loadingContainer = new JPanel(new BorderLayout()); loadingContainer.setOpaque(true); loadingContainer.setBackground(UIUtils.getProfilerResultsBackground()); loadingContainer.setEnabled(false); loadingContainer.add(loading, BorderLayout.CENTER); return loadingContainer; }
Example 9
Source File: CursorOverlappedPanelsTest.java From openjdk-8-source with GNU General Public License v2.0 | 5 votes |
private static JPanel createPanel(Point location, boolean enabled) { final JPanel panel = new JPanel(); panel.setOpaque(false); panel.setEnabled(enabled); panel.setSize(new Dimension(200, 200)); panel.setLocation(location); panel.setBorder(BorderFactory.createTitledBorder( enabled ? "Enabled" : "Disabled")); panel.setCursor(Cursor.getPredefinedCursor( enabled ? Cursor.CROSSHAIR_CURSOR : Cursor.DEFAULT_CURSOR)); System.out.println("cursor: " + Cursor.getPredefinedCursor(enabled ? Cursor.CROSSHAIR_CURSOR : Cursor.DEFAULT_CURSOR)); return panel; }
Example 10
Source File: CursorOverlappedPanelsTest.java From hottub with GNU General Public License v2.0 | 5 votes |
private static JPanel createPanel(Point location, boolean enabled) { final JPanel panel = new JPanel(); panel.setOpaque(false); panel.setEnabled(enabled); panel.setSize(new Dimension(200, 200)); panel.setLocation(location); panel.setBorder(BorderFactory.createTitledBorder( enabled ? "Enabled" : "Disabled")); panel.setCursor(Cursor.getPredefinedCursor( enabled ? Cursor.CROSSHAIR_CURSOR : Cursor.DEFAULT_CURSOR)); System.out.println("cursor: " + Cursor.getPredefinedCursor(enabled ? Cursor.CROSSHAIR_CURSOR : Cursor.DEFAULT_CURSOR)); return panel; }
Example 11
Source File: CursorOverlappedPanelsTest.java From jdk8u-jdk with GNU General Public License v2.0 | 5 votes |
private static JPanel createPanel(Point location, boolean enabled) { final JPanel panel = new JPanel(); panel.setOpaque(false); panel.setEnabled(enabled); panel.setSize(new Dimension(200, 200)); panel.setLocation(location); panel.setBorder(BorderFactory.createTitledBorder( enabled ? "Enabled" : "Disabled")); panel.setCursor(Cursor.getPredefinedCursor( enabled ? Cursor.CROSSHAIR_CURSOR : Cursor.DEFAULT_CURSOR)); System.out.println("cursor: " + Cursor.getPredefinedCursor(enabled ? Cursor.CROSSHAIR_CURSOR : Cursor.DEFAULT_CURSOR)); return panel; }
Example 12
Source File: CursorOverlappedPanelsTest.java From openjdk-jdk9 with GNU General Public License v2.0 | 5 votes |
private static JPanel createPanel(Point location, boolean enabled) { final JPanel panel = new JPanel(); panel.setOpaque(false); panel.setEnabled(enabled); panel.setSize(new Dimension(200, 200)); panel.setLocation(location); panel.setBorder(BorderFactory.createTitledBorder( enabled ? "Enabled" : "Disabled")); panel.setCursor(Cursor.getPredefinedCursor( enabled ? Cursor.CROSSHAIR_CURSOR : Cursor.DEFAULT_CURSOR)); System.out.println("cursor: " + Cursor.getPredefinedCursor(enabled ? Cursor.CROSSHAIR_CURSOR : Cursor.DEFAULT_CURSOR)); return panel; }
Example 13
Source File: CursorOverlappedPanelsTest.java From openjdk-jdk8u-backup with GNU General Public License v2.0 | 5 votes |
private static JPanel createPanel(Point location, boolean enabled) { final JPanel panel = new JPanel(); panel.setOpaque(false); panel.setEnabled(enabled); panel.setSize(new Dimension(200, 200)); panel.setLocation(location); panel.setBorder(BorderFactory.createTitledBorder( enabled ? "Enabled" : "Disabled")); panel.setCursor(Cursor.getPredefinedCursor( enabled ? Cursor.CROSSHAIR_CURSOR : Cursor.DEFAULT_CURSOR)); System.out.println("cursor: " + Cursor.getPredefinedCursor(enabled ? Cursor.CROSSHAIR_CURSOR : Cursor.DEFAULT_CURSOR)); return panel; }
Example 14
Source File: DetailsProvider.java From netbeans with Apache License 2.0 | 5 votes |
private static JComponent initialView() { JLabel loading = new JLabel(Bundle.BrowserUtils_Loading(), JLabel.CENTER); loading.setEnabled(false); JPanel loadingContainer = new JPanel(new BorderLayout()); loadingContainer.setOpaque(true); loadingContainer.setBackground(UIUtils.getProfilerResultsBackground()); loadingContainer.setEnabled(false); loadingContainer.add(loading, BorderLayout.CENTER); return loadingContainer; }
Example 15
Source File: CursorOverlappedPanelsTest.java From openjdk-jdk8u with GNU General Public License v2.0 | 5 votes |
private static JPanel createPanel(Point location, boolean enabled) { final JPanel panel = new JPanel(); panel.setOpaque(false); panel.setEnabled(enabled); panel.setSize(new Dimension(200, 200)); panel.setLocation(location); panel.setBorder(BorderFactory.createTitledBorder( enabled ? "Enabled" : "Disabled")); panel.setCursor(Cursor.getPredefinedCursor( enabled ? Cursor.CROSSHAIR_CURSOR : Cursor.DEFAULT_CURSOR)); System.out.println("cursor: " + Cursor.getPredefinedCursor(enabled ? Cursor.CROSSHAIR_CURSOR : Cursor.DEFAULT_CURSOR)); return panel; }
Example 16
Source File: CursorOverlappedPanelsTest.java From jdk8u60 with GNU General Public License v2.0 | 5 votes |
private static JPanel createPanel(Point location, boolean enabled) { final JPanel panel = new JPanel(); panel.setOpaque(false); panel.setEnabled(enabled); panel.setSize(new Dimension(200, 200)); panel.setLocation(location); panel.setBorder(BorderFactory.createTitledBorder( enabled ? "Enabled" : "Disabled")); panel.setCursor(Cursor.getPredefinedCursor( enabled ? Cursor.CROSSHAIR_CURSOR : Cursor.DEFAULT_CURSOR)); System.out.println("cursor: " + Cursor.getPredefinedCursor(enabled ? Cursor.CROSSHAIR_CURSOR : Cursor.DEFAULT_CURSOR)); return panel; }
Example 17
Source File: CursorOverlappedPanelsTest.java From dragonwell8_jdk with GNU General Public License v2.0 | 5 votes |
private static JPanel createPanel(Point location, boolean enabled) { final JPanel panel = new JPanel(); panel.setOpaque(false); panel.setEnabled(enabled); panel.setSize(new Dimension(200, 200)); panel.setLocation(location); panel.setBorder(BorderFactory.createTitledBorder( enabled ? "Enabled" : "Disabled")); panel.setCursor(Cursor.getPredefinedCursor( enabled ? Cursor.CROSSHAIR_CURSOR : Cursor.DEFAULT_CURSOR)); System.out.println("cursor: " + Cursor.getPredefinedCursor(enabled ? Cursor.CROSSHAIR_CURSOR : Cursor.DEFAULT_CURSOR)); return panel; }
Example 18
Source File: PeakPreviewComboRenderer.java From mzmine2 with GNU General Public License v2.0 | 4 votes |
public Component getListCellRendererComponent(JList<? extends PeakListRow> combo, PeakListRow value, int index, boolean isSelected, boolean cellHasFocus) { PeakListRow row = (PeakListRow) value; if (row == null) return new JPanel(); Feature peak = row.getPeaks()[0]; String labelText = "#" + row.getID() + " " + MZmineCore.getConfiguration().getMZFormat().format(row.getAverageMZ()) + " m/z "; JLabel textComponent = new JLabel(labelText); textComponent.setFont(combo.getFont()); PeakXICComponent shapeComponent = new PeakXICComponent(peak); shapeComponent.setBorder(null); JPanel panel = new JPanel(new BorderLayout()); panel.setOpaque(true); if (isSelected) { panel.setBackground(combo.getSelectionBackground()); panel.setForeground(combo.getSelectionForeground()); } else { panel.setBackground(combo.getBackground()); panel.setForeground(combo.getForeground()); } panel.setEnabled(combo.isEnabled()); Border border = null; if (cellHasFocus) { if (isSelected) { border = UIManager.getBorder("List.focusSelectedCellHighlightBorder"); } if (border == null) { border = UIManager.getBorder("List.focusCellHighlightBorder"); } } else { border = noFocusBorder; } panel.setBorder(border); panel.add(textComponent, BorderLayout.WEST); panel.add(shapeComponent, BorderLayout.CENTER); return panel; }
Example 19
Source File: AnimationsPanel.java From magarena with GNU General Public License v3.0 | 4 votes |
private JPanel getAnimationSubPanel() { final JPanel panel = new SubPanel(); panel.setEnabled(GeneralConfig.get(BooleanSetting.ANIMATE_GAMEPLAY)); return panel; }