Java Code Examples for javax.swing.JPanel#getLayout()
The following examples show how to use
javax.swing.JPanel#getLayout() .
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: rapidminer-studio File: AbstractConfigurationPanel.java License: GNU Affero General Public License v3.0 | 6 votes |
protected void addSeperatorToPanel(JPanel addTarget) { if (!(addTarget.getLayout() instanceof GridBagLayout)) { throw new RuntimeException("JPanel with GridBagLayout is mandatory!"); } JSeparator separator = new JSeparator(SwingConstants.HORIZONTAL); GridBagConstraints itemConstraint = new GridBagConstraints(); itemConstraint.gridx = GridBagConstraints.RELATIVE; itemConstraint.weightx = 1.0; itemConstraint.gridwidth = GridBagConstraints.REMAINDER; // end row itemConstraint.fill = GridBagConstraints.HORIZONTAL; itemConstraint.insets = new Insets(0, 5, 5, 5); addTarget.add(separator, itemConstraint); }
Example 2
Source Project: sldeditor File: MapBoxTool.java License: GNU General Public License v3.0 | 6 votes |
/** Creates the ui. */ private void createUI() { groupPanel = new JPanel(); FlowLayout flowLayout = (FlowLayout) groupPanel.getLayout(); flowLayout.setVgap(0); flowLayout.setHgap(0); TitledBorder titledBorder = BorderFactory.createTitledBorder( Localisation.getString(MapBoxTool.class, "MapBoxTool.groupTitle")); groupPanel.setBorder(titledBorder); // Export to SLD exportToSLDButton = new ToolButton( Localisation.getString(MapBoxTool.class, "MapBoxTool.exportToSLD"), "tool/exporttosld.png"); exportToSLDButton.setEnabled(false); exportToSLDButton.addActionListener( new ActionListener() { public void actionPerformed(ActionEvent e) { exportToSLD(); } }); groupPanel.setPreferredSize(new Dimension(PANEL_WIDTH, ToolPanel.TOOL_PANEL_HEIGHT)); groupPanel.add(exportToSLDButton); }
Example 3
Source Project: sldeditor File: DataSourceConnectorRasterFile.java License: GNU General Public License v3.0 | 6 votes |
/** * Creates the ui. */ private void createUI() { dataSourceFieldPanel = new JPanel(); FlowLayout flowLayout = (FlowLayout) dataSourceFieldPanel.getLayout(); flowLayout.setVgap(0); flowLayout.setHgap(0); JButton btnNewData = new JButton(Localisation.getString(DataSourceConnectorRasterFile.class, "DataSourceConnectorRasterFile.data")); dataSourceFieldPanel.add(btnNewData); dataSourceTextField = new JTextField(); dataSourceFieldPanel.add(dataSourceTextField); dataSourceTextField.setColumns(50); btnNewData.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { chooseDataSourceToOpen(); } }); }
Example 4
Source Project: sldeditor File: DataSourceConnectorShapeFile.java License: GNU General Public License v3.0 | 6 votes |
/** * Creates the ui. */ private void createUI() { dataSourceFieldPanel = new JPanel(); FlowLayout flowLayout = (FlowLayout) dataSourceFieldPanel.getLayout(); flowLayout.setVgap(0); flowLayout.setHgap(0); JButton btnNewData = new JButton(Localisation.getString(DataSourceConnectorShapeFile.class, "DataSourceConnectorShapeFile.data")); dataSourceFieldPanel.add(btnNewData); dataSourceTextField = new JTextField(); dataSourceFieldPanel.add(dataSourceTextField); dataSourceTextField.setColumns(50); btnNewData.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { } }); }
Example 5
Source Project: TencentKona-8 File: Test6437265.java License: GNU General Public License v2.0 | 5 votes |
private static void validate(JPanel panel) { BorderLayout layout = (BorderLayout) panel.getLayout(); for (Component component : panel.getComponents()) { String name = (String) layout.getConstraints(component); if (name == null) throw new Error("The component is not layed out: " + component); JLabel label = (JLabel) component; if (!name.equals(label.getText())) throw new Error("The component is layed out on " + name + ": " + component); } }
Example 6
Source Project: jdk8u60 File: Test6437265.java License: GNU General Public License v2.0 | 5 votes |
private static void validate(JPanel panel) { BorderLayout layout = (BorderLayout) panel.getLayout(); for (Component component : panel.getComponents()) { String name = (String) layout.getConstraints(component); if (name == null) throw new Error("The component is not layed out: " + component); JLabel label = (JLabel) component; if (!name.equals(label.getText())) throw new Error("The component is layed out on " + name + ": " + component); } }
Example 7
Source Project: openjdk-jdk8u File: Test6437265.java License: GNU General Public License v2.0 | 5 votes |
private static void validate(JPanel panel) { BorderLayout layout = (BorderLayout) panel.getLayout(); for (Component component : panel.getComponents()) { String name = (String) layout.getConstraints(component); if (name == null) throw new Error("The component is not layed out: " + component); JLabel label = (JLabel) component; if (!name.equals(label.getText())) throw new Error("The component is layed out on " + name + ": " + component); } }
Example 8
Source Project: netbeans File: CollapsibleSectionPanel.java License: Apache License 2.0 | 5 votes |
public ActionsBuilder (JPanel panel, FocusListener listener) { this.focusListener = listener; panel.removeAll(); GroupLayout layout = (GroupLayout) panel.getLayout(); horizontalSeqGroup = layout.createSequentialGroup(); layout.setHorizontalGroup( layout.createParallelGroup(GroupLayout.Alignment.LEADING) .addGroup(horizontalSeqGroup) ); verticalParallelGroup = layout.createParallelGroup(GroupLayout.Alignment.BASELINE); layout.setVerticalGroup( layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(verticalParallelGroup) ); }
Example 9
Source Project: sldeditor File: StickyDataSourceTool.java License: GNU General Public License v3.0 | 5 votes |
/** Creates the UI. */ private void createUI() { groupPanel = new JPanel(); FlowLayout flowLayout = (FlowLayout) groupPanel.getLayout(); flowLayout.setVgap(0); flowLayout.setHgap(0); groupPanel.setBorder( BorderFactory.createTitledBorder( Localisation.getString( StickyDataSourceTool.class, "StickyDataSourceTool.groupTitle"))); // Export to YSLD stickyButton = new ToggleToolButton( Localisation.getString( StickyDataSourceTool.class, "StickyDataSourceTool.dataSource"), "tool/stickydatasource.png"); stickyButton.setEnabled(true); final StickyDataSourceTool callingObj = this; stickyButton.addActionListener( new ActionListener() { public void actionPerformed(ActionEvent e) { SLDEditorFile.getInstance() .setStickyDataSource(callingObj, stickyButton.isSelected()); } }); groupPanel.add(stickyButton); groupPanel.setPreferredSize(new Dimension(PANEL_WIDTH, ToolPanel.TOOL_PANEL_HEIGHT)); }
Example 10
Source Project: openjdk-jdk9 File: Test6437265.java License: GNU General Public License v2.0 | 5 votes |
private static void validate(JPanel panel) { BorderLayout layout = (BorderLayout) panel.getLayout(); for (Component component : panel.getComponents()) { String name = (String) layout.getConstraints(component); if (name == null) throw new Error("The component is not layed out: " + component); JLabel label = (JLabel) component; if (!name.equals(label.getText())) throw new Error("The component is layed out on " + name + ": " + component); } }
Example 11
Source Project: jdk8u-jdk File: Test6437265.java License: GNU General Public License v2.0 | 5 votes |
private static void validate(JPanel panel) { BorderLayout layout = (BorderLayout) panel.getLayout(); for (Component component : panel.getComponents()) { String name = (String) layout.getConstraints(component); if (name == null) throw new Error("The component is not layed out: " + component); JLabel label = (JLabel) component; if (!name.equals(label.getText())) throw new Error("The component is layed out on " + name + ": " + component); } }
Example 12
Source Project: hottub File: Test6437265.java License: GNU General Public License v2.0 | 5 votes |
private static void validate(JPanel panel) { BorderLayout layout = (BorderLayout) panel.getLayout(); for (Component component : panel.getComponents()) { String name = (String) layout.getConstraints(component); if (name == null) throw new Error("The component is not layed out: " + component); JLabel label = (JLabel) component; if (!name.equals(label.getText())) throw new Error("The component is layed out on " + name + ": " + component); } }
Example 13
Source Project: jdk8u-jdk File: Test6437265.java License: GNU General Public License v2.0 | 5 votes |
private static void validate(JPanel panel) { BorderLayout layout = (BorderLayout) panel.getLayout(); for (Component component : panel.getComponents()) { String name = (String) layout.getConstraints(component); if (name == null) throw new Error("The component is not layed out: " + component); JLabel label = (JLabel) component; if (!name.equals(label.getText())) throw new Error("The component is layed out on " + name + ": " + component); } }
Example 14
Source Project: sldeditor File: ScaleTool.java License: GNU General Public License v3.0 | 5 votes |
/** Creates the ui. */ private void createUI() { scaleGroupPanel = new JPanel(); FlowLayout flowLayout = (FlowLayout) scaleGroupPanel.getLayout(); flowLayout.setVgap(0); flowLayout.setHgap(0); scaleGroupPanel.setBorder( BorderFactory.createTitledBorder( Localisation.getString(ScaleTool.class, "ScaleTool.scale"))); scaleButton = new ToolButton( Localisation.getString(ScaleTool.class, "ScaleTool.scale"), "tool/scaletool.png"); scaleGroupPanel.add(scaleButton); scaleButton.setEnabled(false); scaleButton.addActionListener( new ActionListener() { public void actionPerformed(ActionEvent e) { ScaleToolPanel scalePanel = new ScaleToolPanel(application); scalePanel.populate(sldDataList); scalePanel.setVisible(true); } }); scaleGroupPanel.setPreferredSize(new Dimension(PANEL_WIDTH, ToolPanel.TOOL_PANEL_HEIGHT)); }
Example 15
Source Project: jdk8u_jdk File: Test6437265.java License: GNU General Public License v2.0 | 5 votes |
private static void validate(JPanel panel) { BorderLayout layout = (BorderLayout) panel.getLayout(); for (Component component : panel.getComponents()) { String name = (String) layout.getConstraints(component); if (name == null) throw new Error("The component is not layed out: " + component); JLabel label = (JLabel) component; if (!name.equals(label.getText())) throw new Error("The component is layed out on " + name + ": " + component); } }
Example 16
Source Project: sldeditor File: BatchUpdateFontTool.java License: GNU General Public License v3.0 | 5 votes |
/** Creates the ui. */ private void createUI() { panel = new JPanel(); FlowLayout flowLayout = (FlowLayout) panel.getLayout(); flowLayout.setVgap(0); flowLayout.setHgap(0); panel.setBorder( BorderFactory.createTitledBorder( Localisation.getString( BatchUpdateFontTool.class, "BatchUpdateFontTool.title"))); toolButton = new ToolButton( Localisation.getString( BatchUpdateFontTool.class, "BatchUpdateFontTool.title"), "tool/batchupdatefont.png"); panel.add(toolButton); toolButton.setEnabled(false); toolButton.addActionListener( new ActionListener() { public void actionPerformed(ActionEvent e) { BatchUpdateFontPanel scalePanel = new BatchUpdateFontPanel(application); scalePanel.populate(sldDataList); scalePanel.setVisible(true); } }); panel.setPreferredSize(new Dimension(PANEL_WIDTH, ToolPanel.TOOL_PANEL_HEIGHT)); }
Example 17
Source Project: mzmine3 File: MultiSpectraVisualizerWindow.java License: GNU General Public License v2.0 | 4 votes |
public MultiSpectraVisualizerWindow(PeakListRow row, RawDataFile raw) { setBackground(Color.WHITE); setExtendedState(JFrame.MAXIMIZED_BOTH); setMinimumSize(new Dimension(800, 600)); setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE); getContentPane().setLayout(new BorderLayout()); pnGrid = new JPanel(); // any number of rows pnGrid.setLayout(new GridLayout(0, 1, 0, 25)); pnGrid.setAutoscrolls(true); JScrollPane scrollPane = new JScrollPane(pnGrid); scrollPane.setHorizontalScrollBarPolicy(JScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED); scrollPane.setVerticalScrollBarPolicy(JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED); getContentPane().add(scrollPane, BorderLayout.CENTER); JPanel pnMenu = new JPanel(); FlowLayout fl_pnMenu = (FlowLayout) pnMenu.getLayout(); fl_pnMenu.setVgap(0); fl_pnMenu.setAlignment(FlowLayout.LEFT); getContentPane().add(pnMenu, BorderLayout.NORTH); JButton nextRaw = new JButton("next"); nextRaw.addActionListener(e -> nextRaw()); JButton prevRaw = new JButton("prev"); prevRaw.addActionListener(e -> prevRaw()); pnMenu.add(prevRaw); pnMenu.add(nextRaw); lbRaw = new JLabel(); pnMenu.add(lbRaw); JLabel lbRawTotalWithFragmentation = new JLabel(); pnMenu.add(lbRaw); int n = 0; for (Feature f : row.getPeaks()) { if (f.getMostIntenseFragmentScanNumber() > 0) n++; } lbRawTotalWithFragmentation.setText("(total raw:" + n + ")"); // add charts setData(row, raw); setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE); setVisible(true); validate(); repaint(); pack(); }
Example 18
Source Project: MtgDesktopCompanion File: DeckDetailsPanel.java License: GNU General Public License v3.0 | 4 votes |
public DeckDetailsPanel() { GridBagLayout gridBagLayout = new GridBagLayout(); gridBagLayout.columnWidths = new int[] { 0, 140, 0, 0, 0 }; gridBagLayout.rowHeights = new int[] { 28, 30, 35, 0, 132, 31, 0, 0, 0, 0 }; gridBagLayout.columnWeights = new double[] { 0.0, 0.0, 1.0, 0.0, 1.0E-4 }; gridBagLayout.rowWeights = new double[] { 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 1.0E-4 }; setLayout(gridBagLayout); add(new JLabel(MTGControler.getInstance().getLangService().getCapitalize("DECK_NAME") + " :"), UITools.createGridBagConstraints(null, null, 1, 0)); nameJTextField = new JTextField(); add(nameJTextField, UITools.createGridBagConstraints(null, GridBagConstraints.HORIZONTAL, 2, 0)); add(new JLabel(MTGControler.getInstance().getLangService().getCapitalize("CARD_LEGALITIES") + " :"), UITools.createGridBagConstraints(null, null, 1, 1)); panelLegalities = new JPanel(); FlowLayout flowLayout = (FlowLayout) panelLegalities.getLayout(); flowLayout.setHgap(10); flowLayout.setAlignment(FlowLayout.LEFT); add(panelLegalities, UITools.createGridBagConstraints(null, GridBagConstraints.BOTH, 2, 1)); add(new JLabel(MTGControler.getInstance().getLangService().getCapitalize("CARD_COLOR") + " :"), UITools.createGridBagConstraints(null, null, 1, 2)); manaPanel = new ManaPanel(); add(manaPanel, UITools.createGridBagConstraints(null, GridBagConstraints.BOTH, 2, 2)); lblDate = new JLabel(MTGControler.getInstance().getLangService().getCapitalize("DATE") + " :"); add(lblDate, UITools.createGridBagConstraints(null, null, 1, 3)); lblDateInformation = new JLabel(""); add(lblDateInformation, UITools.createGridBagConstraints(GridBagConstraints.WEST, null, 2, 3)); add(new JLabel(MTGControler.getInstance().getLangService().getCapitalize("DESCRIPTION") + " :"), UITools.createGridBagConstraints(null, null, 1, 4)); textArea = new JTextArea(); textArea.setLineWrap(true); textArea.setWrapStyleWord(true); add(new JLabel(MTGControler.getInstance().getLangService().getCapitalize("QTY") + " :"), UITools.createGridBagConstraints(null, null, 1, 5)); nbCardsProgress = new JProgressBar(); nbCardsProgress.setStringPainted(true); add(nbCardsProgress, UITools.createGridBagConstraints(null, GridBagConstraints.HORIZONTAL, 2, 5)); lbstd = new JLabel(" STD "); lbstd.setOpaque(true); lbstd.setBackground(Color.GREEN); lbmnd = new JLabel(" MDN "); lbmnd.setOpaque(true); lbmnd.setBackground(Color.GREEN); lbvin = new JLabel(" VIN "); lbvin.setOpaque(true); lbvin.setBackground(Color.GREEN); lbcmd = new JLabel(" CMD "); lbcmd.setOpaque(true); lbcmd.setBackground(Color.GREEN); lbLeg = new JLabel(" LEG "); lbLeg.setOpaque(true); lbLeg.setBackground(Color.GREEN); panelLegalities.add(lbvin); panelLegalities.add(lbLeg); panelLegalities.add(lbstd); panelLegalities.add(lbmnd); panelLegalities.add(lbcmd); add(new JLabel(MTGControler.getInstance().getLangService().getCapitalize("SIDEBOARD") + " :"), UITools.createGridBagConstraints(null, null, 1, 6)); nbSideProgress = new JProgressBar(); nbSideProgress.setMaximum(15); nbSideProgress.setStringPainted(true); add(nbSideProgress, UITools.createGridBagConstraints(null, GridBagConstraints.HORIZONTAL, 2, 6)); add(new JScrollPane(textArea), UITools.createGridBagConstraints(null, GridBagConstraints.BOTH, 2, 4)); add(new JLabel(MTGControler.getInstance().getLangService().getCapitalize("TAGS") + " :"), UITools.createGridBagConstraints(null, GridBagConstraints.BOTH, 1, 7)); tagsPanel = new JTagsPanel(); add(tagsPanel, UITools.createGridBagConstraints(GridBagConstraints.WEST, GridBagConstraints.VERTICAL, 2, 7)); panel = new JPanel(); add(panel, UITools.createGridBagConstraints(null, GridBagConstraints.BOTH, 2, 8)); if (magicDeck != null) { mBindingGroup = initDataBindings(); } }
Example 19
Source Project: snap-desktop File: ExpressionPane.java License: GNU General Public License v3.0 | 4 votes |
private static void add(JPanel panel, Component comp, GridBagConstraints gbc) { final GridBagLayout gbl = (GridBagLayout) panel.getLayout(); gbl.setConstraints(comp, gbc); panel.add(comp, gbc); }
Example 20
Source Project: sldeditor File: SaveSLDTool.java License: GNU General Public License v3.0 | 4 votes |
/** Creates the ui. */ private void createUI() { groupPanel = new JPanel(); FlowLayout flowLayout = (FlowLayout) groupPanel.getLayout(); flowLayout.setVgap(0); flowLayout.setHgap(0); groupPanel.setBorder( BorderFactory.createTitledBorder( Localisation.getString(SaveSLDTool.class, "SaveSLDTool.save"))); saveAllSLD = new ToolButton( Localisation.getString(SaveSLDTool.class, "SaveSLDTool.sld"), "tool/savesld.png"); saveAllSLD.setEnabled(false); saveAllSLD.addActionListener( new ActionListener() { public void actionPerformed(ActionEvent e) { JFileChooser chooser = new JFileChooser(); chooser.setCurrentDirectory(new java.io.File(".")); chooser.setDialogTitle( Localisation.getString( SaveSLDTool.class, "SaveSLDTool.destinationFolder")); chooser.setFileSelectionMode(JFileChooser.DIRECTORIES_ONLY); // // Disable the "All files" option. // chooser.setAcceptAllFileFilterUsed(false); // Save external images option JPanel accessory = new JPanel(); JCheckBox isOpenBox = new JCheckBox( Localisation.getString( SaveSLDTool.class, "SaveSLDTool.saveExternalImages")); accessory.setLayout(new BorderLayout()); accessory.add(isOpenBox, BorderLayout.CENTER); chooser.setAccessory(accessory); if (chooser.showSaveDialog(saveAllSLD) == JFileChooser.APPROVE_OPTION) { worker.saveAllSLDToFolder( sldDataList, chooser.getSelectedFile(), isOpenBox.isSelected()); } } }); groupPanel.add(saveAllSLD); saveAllSLD.setPreferredSize(new Dimension(PANEL_WIDTH, ToolPanel.TOOL_PANEL_HEIGHT)); }