List of usage examples for javax.swing SwingConstants HORIZONTAL
int HORIZONTAL
To view the source code for javax.swing SwingConstants HORIZONTAL.
Click Source Link
From source file:MixerTest2.java
public VolumeRenderer() { super(SwingConstants.HORIZONTAL); // set a starting size...some 1.2/1.3 systems need this setSize(115, 15); }
From source file:de.fhg.igd.iva.explorer.main.CompareViewPanel.java
protected void updateSelection() { KnownColormap colormap = (KnownColormap) mapsCombo.getSelectedItem(); cmView.setColormap(colormap);// w ww.j a v a2 s .co m statsBars.removeAll(); Map<ColormapQuality, Double> row = table.row(colormap); Insets insets = new Insets(0, 0, 0, 0); Insets insets5 = new Insets(0, 5, 0, 0); GridBagConstraints gbcName = new GridBagConstraints(0, 0, 1, 1, 0.0, 1.0, GridBagConstraints.LINE_START, GridBagConstraints.NONE, insets, 0, 0); GridBagConstraints gbcQual = new GridBagConstraints(1, 0, 1, 1, 0.0, 1.0, GridBagConstraints.LINE_END, GridBagConstraints.NONE, insets5, 0, 0); GridBagConstraints gbcRank = new GridBagConstraints(2, 0, 1, 1, 0.0, 1.0, GridBagConstraints.LINE_END, GridBagConstraints.NONE, insets5, 0, 0); GridBagConstraints gbcStatL = new GridBagConstraints(3, 0, 1, 1, 1.0, 1.0, GridBagConstraints.LINE_START, GridBagConstraints.NONE, insets5, 0, 0); GridBagConstraints gbcStatR = new GridBagConstraints(4, 0, 1, 1, 1.0, 1.0, GridBagConstraints.LINE_END, GridBagConstraints.NONE, insets5, 0, 0); GridBagConstraints gbcStat = new GridBagConstraints(3, 0, 2, 1, 1.0, 1.0, GridBagConstraints.LINE_START, GridBagConstraints.HORIZONTAL, insets5, 0, 0); statsBars.add(new JLabel("Name"), gbcName); statsBars.add(new JLabel("Score"), gbcQual); statsBars.add(new JLabel("Rank"), gbcRank); // maybe use a best/worst arrow down marker instead? unicode: \u2193 statsBars.add(new JLabel("\u2190Worse"), gbcStatL); statsBars.add(new JLabel("Better\u2192"), gbcStatR); GridBagConstraints gbcSpace = new GridBagConstraints(0, 1, 5, 1, 1.0, 1.0, GridBagConstraints.LINE_START, GridBagConstraints.HORIZONTAL, new Insets(0, 0, 5, 0), 0, 0); JSeparator spacing = new JSeparator(SwingConstants.HORIZONTAL); statsBars.add(spacing, gbcSpace); int count = table.rowKeySet().size(); int rowIdx = 2; for (ColormapQuality metric : row.keySet()) { double quality = row.get(metric); DescriptiveStatistics stats = computeStats(metric); int index = Arrays.binarySearch(stats.getSortedValues(), quality); int rank = metric.moreIsBetter() ? count - index : index + 1; gbcName = (GridBagConstraints) gbcName.clone(); gbcQual = (GridBagConstraints) gbcQual.clone(); gbcRank = (GridBagConstraints) gbcRank.clone(); gbcStat = (GridBagConstraints) gbcStat.clone(); gbcName.gridy = rowIdx; gbcQual.gridy = rowIdx; gbcRank.gridy = rowIdx; gbcStat.gridy = rowIdx; statsBars.add(new JLabel(metric.getName()), gbcName); statsBars.add(new JLabel(String.format("%.2f", quality)), gbcQual); statsBars.add(new JLabel(Integer.toString(rank)), gbcRank); statsBars.add(new JStatBar(metric, stats, quality), gbcStat); rowIdx++; } // I find it strange that both revalidate and repaint must be explicitly called here revalidate(); repaint(); }
From source file:net.sf.jabref.gui.preftabs.PreviewPrefsTab.java
public PreviewPrefsTab(JabRefPreferences prefs) { this.prefs = prefs; GridBagLayout layout = new GridBagLayout(); firstPanel.setLayout(layout);//from w w w.j a v a 2s . c o m secondPanel.setLayout(layout); setLayout(layout); JLabel lab = new JLabel(Localization.lang("Preview") + " 1"); GridBagConstraints layoutConstraints = new GridBagConstraints(); layoutConstraints.anchor = GridBagConstraints.WEST; layoutConstraints.gridwidth = GridBagConstraints.REMAINDER; layoutConstraints.fill = GridBagConstraints.BOTH; layoutConstraints.weightx = 1; layoutConstraints.weighty = 0; layoutConstraints.insets = new Insets(2, 2, 2, 2); layout.setConstraints(lab, layoutConstraints); layoutConstraints.weighty = 1; layout.setConstraints(firstScrollPane, layoutConstraints); firstPanel.add(firstScrollPane); layoutConstraints.weighty = 0; layoutConstraints.gridwidth = 1; layoutConstraints.weightx = 0; layoutConstraints.fill = GridBagConstraints.NONE; layoutConstraints.anchor = GridBagConstraints.WEST; layout.setConstraints(testButton, layoutConstraints); firstPanel.add(testButton); layout.setConstraints(defaultButton, layoutConstraints); firstPanel.add(defaultButton); layoutConstraints.gridwidth = GridBagConstraints.REMAINDER; JPanel newPan = new JPanel(); layoutConstraints.weightx = 1; layout.setConstraints(newPan, layoutConstraints); firstPanel.add(newPan); lab = new JLabel(Localization.lang("Preview") + " 2"); layout.setConstraints(lab, layoutConstraints); // p2.add(lab); layoutConstraints.weighty = 1; layoutConstraints.fill = GridBagConstraints.BOTH; layout.setConstraints(secondScrollPane, layoutConstraints); secondPanel.add(secondScrollPane); layoutConstraints.weighty = 0; layoutConstraints.weightx = 0; layoutConstraints.fill = GridBagConstraints.NONE; layoutConstraints.gridwidth = 1; layout.setConstraints(testButton2, layoutConstraints); secondPanel.add(testButton2); layout.setConstraints(defaultButton2, layoutConstraints); secondPanel.add(defaultButton2); layoutConstraints.gridwidth = 1; newPan = new JPanel(); layoutConstraints.weightx = 1; layout.setConstraints(newPan, layoutConstraints); secondPanel.add(newPan); layoutConstraints.weightx = 1; layoutConstraints.weighty = 0; layoutConstraints.fill = GridBagConstraints.BOTH; layoutConstraints.gridwidth = GridBagConstraints.REMAINDER; lab = new JLabel(Localization.lang("Preview") + " 1"); layout.setConstraints(lab, layoutConstraints); add(lab); layoutConstraints.weighty = 1; layout.setConstraints(firstPanel, layoutConstraints); add(firstPanel); lab = new JLabel(Localization.lang("Preview") + " 2"); layoutConstraints.weighty = 0; JSeparator sep = new JSeparator(SwingConstants.HORIZONTAL); layout.setConstraints(sep, layoutConstraints); add(sep); layout.setConstraints(lab, layoutConstraints); add(lab); layoutConstraints.weighty = 1; layout.setConstraints(secondPanel, layoutConstraints); add(secondPanel); layoutConstraints.weighty = 0; defaultButton.addActionListener(e -> { String tmp = layout1.getText().replace("\n", "__NEWLINE__"); PreviewPrefsTab.this.prefs.remove(JabRefPreferences.PREVIEW_0); layout1.setText( PreviewPrefsTab.this.prefs.get(JabRefPreferences.PREVIEW_0).replace("__NEWLINE__", "\n")); PreviewPrefsTab.this.prefs.put(JabRefPreferences.PREVIEW_0, tmp); }); defaultButton2.addActionListener(e -> { String tmp = layout2.getText().replace("\n", "__NEWLINE__"); PreviewPrefsTab.this.prefs.remove(JabRefPreferences.PREVIEW_1); layout2.setText( PreviewPrefsTab.this.prefs.get(JabRefPreferences.PREVIEW_1).replace("__NEWLINE__", "\n")); PreviewPrefsTab.this.prefs.put(JabRefPreferences.PREVIEW_1, tmp); }); testButton.addActionListener(e -> { PreviewPrefsTab.getTestEntry(); try { PreviewPanel testPanel = new PreviewPanel(null, PreviewPrefsTab.entry, null, layout1.getText()); testPanel.setPreferredSize(new Dimension(800, 350)); JOptionPane.showMessageDialog(null, testPanel, Localization.lang("Preview"), JOptionPane.PLAIN_MESSAGE); } catch (StringIndexOutOfBoundsException ex) { LOGGER.warn("Parsing error.", ex); JOptionPane.showMessageDialog(null, Localization.lang("Parsing error") + ": " + Localization.lang("illegal backslash expression") + ".\n" + ex.getMessage(), Localization.lang("Parsing error"), JOptionPane.ERROR_MESSAGE); } }); testButton2.addActionListener(e -> { PreviewPrefsTab.getTestEntry(); try { PreviewPanel testPanel = new PreviewPanel(null, PreviewPrefsTab.entry, null, layout2.getText()); testPanel.setPreferredSize(new Dimension(800, 350)); JOptionPane.showMessageDialog(null, new JScrollPane(testPanel), Localization.lang("Preview"), JOptionPane.PLAIN_MESSAGE); } catch (StringIndexOutOfBoundsException ex) { LOGGER.warn("Parsing error.", ex); JOptionPane.showMessageDialog(null, Localization.lang("Parsing error") + ": " + Localization.lang("illegal backslash expression") + ".\n" + ex.getMessage(), Localization.lang("Parsing error"), JOptionPane.ERROR_MESSAGE); } }); }
From source file:llc.rockford.webcast.EC2Driver.java
public Component createComponents() { startButton = new JButton("START SERVER"); startButton.setEnabled(false);// ww w . ja v a 2s .co m startButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { startButton.setEnabled(false); stopButton.setEnabled(false); new StartInstanceWorker(ec2Handle.getEc2Handle(), applicationState, amazonProperties).execute(); } }); startStreamButton = new JButton("START BROADCAST"); startStreamButton.setEnabled(false); startStreamButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { startStreamButton.setEnabled(false); stopStreamButton.setEnabled(true); try { broadcaster.start(); } catch (ExecuteException e1) { startStreamButton.setEnabled(true); e1.printStackTrace(); } catch (IOException e1) { startStreamButton.setEnabled(true); e1.printStackTrace(); } catch (InterruptedException e1) { e1.printStackTrace(); } } }); stopStreamButton = new JButton("STOP BROADCAST"); stopStreamButton.setEnabled(false); stopStreamButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { broadcaster.stop(); } }); statusLabel.setHorizontalAlignment(SwingConstants.CENTER); statusLabel.setOpaque(true); statusLabel.setBackground(Color.YELLOW); broadcastStatusLabel.setHorizontalAlignment(SwingConstants.CENTER); broadcastStatusLabel.setOpaque(true); broadcastStatusLabel.setBackground(Color.RED); stopButton = new JButton("STOP SERVER"); stopButton.setEnabled(false); stopButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { startButton.setEnabled(false); stopButton.setEnabled(false); new TerminateInstanceWorker(ec2Handle.getEc2Handle(), applicationState, amazonProperties).execute(); } }); JPanel pane = new JPanel(new GridLayout(7, 1)); pane.add(startButton); pane.add(statusLabel); pane.add(stopButton); pane.add(new JSeparator(SwingConstants.HORIZONTAL)); pane.add(startStreamButton); pane.add(broadcastStatusLabel); pane.add(stopStreamButton); pane.setBorder(BorderFactory.createEmptyBorder(30, // top 30, // left 10, // bottom 30) // right ); return pane; }
From source file:de.tud.kom.p2psim.impl.skynet.visualization.SkyNetVisualization.java
public void setAvailableMetrics(Vector<String> names) { Vector<String> temp = new Vector<String>(); temp.addAll(names);/* ww w.ja va 2 s.c o m*/ temp.add("Online Peers"); temp.add("Available Attributes"); temp.add("Memory Usage"); Collections.sort(temp); JMenu met = mb.getMenu(1); met.setEnabled(true); JMenu avgMet = new JMenu("Average Metrics"); JMenu genMet = new JMenu("General Metrics"); JMenu recMet = new JMenu("Metrics for Receiving"); JMenu sentMet = new JMenu("Metrics for Sending"); JCheckBoxMenuItem item = null; for (String name : temp) { if (name.startsWith("Aver")) { item = new JCheckBoxMenuItem(name, false); item.addActionListener(this); avgMet.add(item); } else if (name.startsWith("Rec")) { item = new JCheckBoxMenuItem(name, false); item.addActionListener(this); recMet.add(item); } else if (name.startsWith("Sent")) { item = new JCheckBoxMenuItem(name, false); item.addActionListener(this); sentMet.add(item); } else { item = new JCheckBoxMenuItem(name, false); item.addActionListener(this); genMet.add(item); } } avgMet.add(new JSeparator(SwingConstants.HORIZONTAL)); avgMet.add(createMenuItem("Display all Average Metrics")); avgMet.add(createMenuItem("Remove all Average Metrics")); genMet.add(new JSeparator(SwingConstants.HORIZONTAL)); genMet.add(createMenuItem("Display all General Metrics")); genMet.add(createMenuItem("Remove all General Metrics")); recMet.add(new JSeparator(SwingConstants.HORIZONTAL)); recMet.add(createMenuItem("Display all Metrics for Receiving")); recMet.add(createMenuItem("Remove all Metrics for Receiving")); sentMet.add(new JSeparator(SwingConstants.HORIZONTAL)); sentMet.add(createMenuItem("Display all Metrics for Sending")); sentMet.add(createMenuItem("Remove all Metrics for Sending")); met.add(avgMet); met.add(genMet); met.add(recMet); met.add(sentMet); met.add(new JSeparator(SwingConstants.HORIZONTAL)); met.add(createMenuItem("Display all Metrics")); met.add(createMenuItem("Remove all Metrics")); mb.add(met); repaint(); log.warn("Created Menu 'Available Metrics'"); }
From source file:com.microsoft.alm.plugin.idea.common.ui.common.tabs.TabFormImpl.java
/** * Creates the toolbar for top of the tab * * @param actions/* w ww . ja v a2s .c o m*/ * @return */ protected ActionToolbar createToolbar(DefaultActionGroup actions) { final ActionToolbar toolbar = ActionManager.getInstance().createActionToolbar(toolbarLocation, actions, false); toolbar.setOrientation(SwingConstants.HORIZONTAL); toolbar.setTargetComponent(scrollPanel); return toolbar; }
From source file:com.igormaznitsa.jhexed.swing.editor.ui.dialogs.hexeditors.DialogEditSVGImageValue.java
/** * This method is called from within the constructor to initialize the form. * WARNING: Do NOT modify this code. The content of this method is always * regenerated by the Form Editor.// ww w.jav a2s .co m */ @SuppressWarnings("unchecked") // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents private void initComponents() { jLabel1 = new javax.swing.JLabel(); textName = new javax.swing.JTextField(); jScrollPane1 = new javax.swing.JScrollPane(); textComments = new javax.swing.JTextArea(); buttonCancel = new javax.swing.JButton(); buttonOk = new javax.swing.JButton(); panelPreview = new javax.swing.JPanel(); buttonLoad = new javax.swing.JButton(); buttonSaveAs = new javax.swing.JButton(); setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE); setLocationByPlatform(true); jLabel1.setText("Name:"); jScrollPane1.setBorder(javax.swing.BorderFactory.createTitledBorder("Commentary")); textComments.setColumns(20); textComments.setRows(5); jScrollPane1.setViewportView(textComments); buttonCancel.setIcon(new javax.swing.ImageIcon( getClass().getResource("/com/igormaznitsa/jhexed/swing/editor/icons/cross.png"))); // NOI18N buttonCancel.setText("Cancel"); buttonCancel.setToolTipText("Reject changes"); buttonCancel.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { buttonCancelActionPerformed(evt); } }); buttonOk.setIcon(new javax.swing.ImageIcon( getClass().getResource("/com/igormaznitsa/jhexed/swing/editor/icons/tick.png"))); // NOI18N buttonOk.setText("Ok"); buttonOk.setToolTipText("Save the changes"); buttonOk.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { buttonOkActionPerformed(evt); } }); panelPreview.setBorder(javax.swing.BorderFactory.createTitledBorder("Preview")); panelPreview.addMouseListener(new java.awt.event.MouseAdapter() { public void mouseClicked(java.awt.event.MouseEvent evt) { panelPreviewMouseClicked(evt); } }); panelPreview.setLayout(new java.awt.BorderLayout()); buttonLoad.setIcon(new javax.swing.ImageIcon( getClass().getResource("/com/igormaznitsa/jhexed/swing/editor/icons/drive-upload.png"))); // NOI18N buttonLoad.setText("Load from file"); buttonLoad.setToolTipText("Load the image from a file"); buttonLoad.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { buttonLoadActionPerformed(evt); } }); buttonSaveAs.setIcon(new javax.swing.ImageIcon( getClass().getResource("/com/igormaznitsa/jhexed/swing/editor/icons/drive-download.png"))); // NOI18N buttonSaveAs.setText("Save as file"); buttonSaveAs.setToolTipText("Save the image as a file"); buttonSaveAs.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { buttonSaveAsActionPerformed(evt); } }); javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane()); getContentPane().setLayout(layout); layout.setHorizontalGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(layout.createSequentialGroup().addContainerGap().addGroup(layout .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addComponent(panelPreview, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addComponent(jScrollPane1, javax.swing.GroupLayout.DEFAULT_SIZE, 376, Short.MAX_VALUE) .addGroup(layout.createSequentialGroup().addComponent(jLabel1) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addComponent(textName)) .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup().addGap(0, 0, Short.MAX_VALUE).addComponent(buttonOk) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addComponent(buttonCancel)) .addGroup(layout.createSequentialGroup().addComponent(buttonLoad) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addComponent(buttonSaveAs).addGap(0, 0, Short.MAX_VALUE))) .addContainerGap())); layout.linkSize(javax.swing.SwingConstants.HORIZONTAL, new java.awt.Component[] { buttonCancel, buttonOk }); layout.linkSize(javax.swing.SwingConstants.HORIZONTAL, new java.awt.Component[] { buttonLoad, buttonSaveAs }); layout.setVerticalGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(layout.createSequentialGroup().addContainerGap() .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(jLabel1).addComponent(textName, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addComponent(jScrollPane1, javax.swing.GroupLayout.PREFERRED_SIZE, 115, javax.swing.GroupLayout.PREFERRED_SIZE) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addComponent(panelPreview, javax.swing.GroupLayout.DEFAULT_SIZE, 135, Short.MAX_VALUE) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(buttonLoad).addComponent(buttonSaveAs)) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(buttonCancel).addComponent(buttonOk)) .addContainerGap())); pack(); }
From source file:esmska.gui.AboutFrame.java
/** This method is called from within the constructor to * initialize the form.//from w w w. ja v a 2 s . co m * WARNING: Do NOT modify this code. The content of this method is * always regenerated by the Form Editor. */ // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents private void initComponents() { jLabel1 = new JLabel(); jLabel2 = new JLabel(); jLabel3 = new JLabel(); creditsButton = new JButton(); closeButton = new JButton(); licenseButton = new JButton(); jLabel5 = new JLabel(); jLabel4 = new JLabel(); jLabel6 = new JLabel(); jLabel7 = new JLabel(); jLabel8 = new JLabel(); homeHyperlink = new JXHyperlink(); supportHyperlink = new JXHyperlink(); setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE); ResourceBundle bundle = ResourceBundle.getBundle("esmska/resources/l10n"); // NOI18N setTitle(bundle.getString("AboutFrame.title")); // NOI18N setLocationByPlatform(true); jLabel1.setHorizontalAlignment(SwingConstants.CENTER); jLabel1.setIcon(new ImageIcon(getClass().getResource("/esmska/resources/esmska.png"))); // NOI18N jLabel1.setFocusable(false); jLabel2.setFont(jLabel2.getFont().deriveFont(jLabel2.getFont().getStyle() | Font.BOLD, jLabel2.getFont().getSize() + 22)); jLabel2.setHorizontalAlignment(SwingConstants.CENTER); Mnemonics.setLocalizedText(jLabel2, "Esmska " + config.getLatestVersion()); jLabel2.setFocusable(false); jLabel3.setHorizontalAlignment(SwingConstants.CENTER); Mnemonics.setLocalizedText(jLabel3, bundle.getString("AboutFrame.jLabel3.text")); // NOI18N jLabel3.setFocusable(false); creditsButton.setIcon(new ImageIcon(getClass().getResource("/esmska/resources/about-22.png"))); // NOI18N Mnemonics.setLocalizedText(creditsButton, bundle.getString("AboutFrame.creditsButton.text")); creditsButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent evt) { creditsButtonActionPerformed(evt); } }); closeButton.setIcon(new ImageIcon(getClass().getResource("/esmska/resources/close-22.png"))); // NOI18N Mnemonics.setLocalizedText(closeButton, bundle.getString("Close_")); closeButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent evt) { closeButtonActionPerformed(evt); } }); Mnemonics.setLocalizedText(licenseButton, bundle.getString("AboutFrame.licenseButton.text")); licenseButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent evt) { licenseButtonActionPerformed(evt); } }); jLabel5.setFont(jLabel5.getFont().deriveFont(jLabel5.getFont().getSize() - 2f)); jLabel5.setHorizontalAlignment(SwingConstants.CENTER); jLabel5.setIcon(new ImageIcon(getClass().getResource("/esmska/resources/copyleft-12.png"))); // NOI18N Mnemonics.setLocalizedText(jLabel5, bundle.getString("AboutFrame.jLabel5.text")); // NOI18N jLabel5.setFocusable(false); setURI(homeHyperlink, Links.getURI(Links.HOMEPAGE)); Mnemonics.setLocalizedText(homeHyperlink, l10n.getString("AboutFrame.homeHyperlink.text")); homeHyperlink.setToolTipText(l10n.getString("AboutFrame.homeHyperlink.toolTipText")); // NOI18N setURI(supportHyperlink, Links.getURI(Links.DONATE)); Mnemonics.setLocalizedText(supportHyperlink, l10n.getString("AboutFrame.supportHyperlink.text")); supportHyperlink.setToolTipText(l10n.getString("AboutFrame.supportHyperlink.toolTipText")); // NOI18N GroupLayout layout = new GroupLayout(getContentPane()); getContentPane().setLayout(layout); layout.setHorizontalGroup(layout.createParallelGroup(Alignment.LEADING).addGroup(layout .createSequentialGroup().addContainerGap() .addGroup(layout.createParallelGroup(Alignment.LEADING) .addComponent(jLabel5, Alignment.CENTER, GroupLayout.DEFAULT_SIZE, 451, Short.MAX_VALUE) .addComponent(homeHyperlink, Alignment.CENTER, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE) .addComponent(supportHyperlink, Alignment.CENTER, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE) .addComponent(jLabel3, Alignment.CENTER, GroupLayout.DEFAULT_SIZE, 451, Short.MAX_VALUE) .addComponent(jLabel2, Alignment.CENTER, GroupLayout.DEFAULT_SIZE, 451, Short.MAX_VALUE) .addComponent(jLabel1, Alignment.CENTER, GroupLayout.DEFAULT_SIZE, 451, Short.MAX_VALUE) .addGroup(layout.createSequentialGroup().addComponent(creditsButton) .addPreferredGap(ComponentPlacement.RELATED).addComponent(licenseButton) .addPreferredGap(ComponentPlacement.RELATED, 151, Short.MAX_VALUE) .addComponent(closeButton)) .addGroup(layout.createSequentialGroup() .addComponent(jLabel4, GroupLayout.DEFAULT_SIZE, 171, Short.MAX_VALUE) .addGap(108, 108, 108) .addComponent(jLabel6, GroupLayout.DEFAULT_SIZE, 172, Short.MAX_VALUE)) .addGroup(layout.createSequentialGroup() .addComponent(jLabel8, GroupLayout.DEFAULT_SIZE, 157, Short.MAX_VALUE) .addGap(138, 138, 138) .addComponent(jLabel7, GroupLayout.DEFAULT_SIZE, 156, Short.MAX_VALUE))) .addContainerGap())); layout.linkSize(SwingConstants.HORIZONTAL, new Component[] { closeButton, creditsButton, licenseButton }); layout.setVerticalGroup( layout.createParallelGroup(Alignment.LEADING).addGroup(Alignment.TRAILING, layout.createSequentialGroup().addContainerGap().addComponent(jLabel1).addGap(18, 18, 18) .addComponent(jLabel2).addPreferredGap(ComponentPlacement.RELATED) .addComponent(jLabel3).addPreferredGap(ComponentPlacement.UNRELATED) .addComponent(jLabel5).addGap(18, 18, 18) .addGroup(layout.createParallelGroup(Alignment.LEADING) .addGroup(layout.createSequentialGroup() .addGroup(layout.createParallelGroup(Alignment.BASELINE) .addComponent(jLabel4).addComponent(jLabel6)) .addPreferredGap(ComponentPlacement.RELATED) .addGroup(layout.createParallelGroup(Alignment.BASELINE) .addComponent(jLabel7).addComponent(jLabel8))) .addComponent(homeHyperlink, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)) .addPreferredGap(ComponentPlacement.UNRELATED) .addComponent(supportHyperlink, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE) .addPreferredGap(ComponentPlacement.RELATED, 48, Short.MAX_VALUE) .addGroup(layout.createParallelGroup(Alignment.BASELINE).addComponent(creditsButton) .addComponent(closeButton).addComponent(licenseButton)) .addContainerGap())); layout.linkSize(SwingConstants.VERTICAL, new Component[] { jLabel4, jLabel6 }); layout.linkSize(SwingConstants.VERTICAL, new Component[] { closeButton, creditsButton, licenseButton }); pack(); }
From source file:de.ailis.xadrian.frames.MainFrame.java
/** * Creates the tool bar./*from w ww . j a va2 s. c o m*/ */ private void createToolBar() { final JToolBar toolBar = new JToolBar(SwingConstants.HORIZONTAL); toolBar.setFloatable(false); toolBar.setRollover(true); toolBar.add(this.exitAction); toolBar.addSeparator(); toolBar.add(this.newAction); toolBar.add(this.openAction); toolBar.add(this.closeAction); toolBar.add(this.saveAction); toolBar.add(this.printAction); toolBar.addSeparator(); toolBar.add(this.addFactoryAction); toolBar.add(this.changeSectorAction); toolBar.add(this.changeSunsAction); toolBar.add(this.changePricesAction); final JToggleButton btn = new JToggleButton(this.toggleBaseComplexAction); btn.setHideActionText(true); toolBar.add(btn); add(toolBar, BorderLayout.NORTH); installStatusHandler(toolBar); }
From source file:net.sf.jabref.openoffice.AutoDetectPaths.java
public JDialog showProgressDialog(JDialog progressParent, String title, String message, boolean includeCancelButton) { fileSearchCancelled = false;/*from w w w.j a va 2 s. c om*/ JProgressBar bar = new JProgressBar(SwingConstants.HORIZONTAL); JButton cancel = new JButton(Localization.lang("Cancel")); cancel.addActionListener(event -> { fileSearchCancelled = true; ((JButton) event.getSource()).setEnabled(false); }); final JDialog progressDialog = new JDialog(progressParent, title, false); bar.setBorder(BorderFactory.createEmptyBorder(10, 10, 10, 10)); bar.setIndeterminate(true); if (includeCancelButton) { progressDialog.add(cancel, BorderLayout.SOUTH); } progressDialog.add(new JLabel(message), BorderLayout.NORTH); progressDialog.add(bar, BorderLayout.CENTER); progressDialog.pack(); progressDialog.setLocationRelativeTo(null); progressDialog.setVisible(true); return progressDialog; }