List of usage examples for javax.swing SwingConstants VERTICAL
int VERTICAL
To view the source code for javax.swing SwingConstants VERTICAL.
Click Source Link
From source file:course_generator.frmMain.java
/** * Create the map toolbar/*from w w w. java 2s.c o m*/ */ private void Create_Map_Toolbar() { jToolBarMapViewer = new javax.swing.JToolBar(); jToolBarMapViewer.setFloatable(false); jToolBarMapViewer.setOrientation(javax.swing.SwingConstants.VERTICAL); jToolBarMapViewer.setRollover(true); // -- Add marker btMapAddMarker = new javax.swing.JButton(); btMapAddMarker .setIcon(new javax.swing.ImageIcon(getClass().getResource("/course_generator/images/marker.png"))); btMapAddMarker.setToolTipText(bundle.getString("frmMain.btMapAddMarker.toolTipText")); btMapAddMarker.setFocusable(false); btMapAddMarker.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { // btOpenCGXActionPerformed(evt); //TODO } }); btMapAddMarker.setEnabled(false); jToolBarMapViewer.add(btMapAddMarker); // -- Hide marker btMapHideMarker = new javax.swing.JButton(); btMapHideMarker.setIcon( new javax.swing.ImageIcon(getClass().getResource("/course_generator/images/hide_marker.png"))); btMapHideMarker.setToolTipText(bundle.getString("frmMain.btMapHideMarker.toolTipText")); btMapHideMarker.setFocusable(false); btMapHideMarker.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { // btOpenCGXActionPerformed(evt); //TODO } }); btMapHideMarker.setEnabled(false); jToolBarMapViewer.add(btMapHideMarker); // -- Separator jToolBarMapViewer.add(new javax.swing.JToolBar.Separator()); // -- Undo btMapUndo = new javax.swing.JButton(); btMapUndo.setIcon(new javax.swing.ImageIcon(getClass().getResource("/course_generator/images/undo.png"))); btMapUndo.setToolTipText(bundle.getString("frmMain.btMapUndo.toolTipText")); btMapUndo.setFocusable(false); btMapUndo.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { // btOpenCGXActionPerformed(evt); //TODO } }); btMapUndo.setEnabled(false); jToolBarMapViewer.add(btMapUndo); // -- Separator jToolBarMapViewer.add(new javax.swing.JToolBar.Separator()); // -- Track very easy btMapTrackVeryEasy = new javax.swing.JButton(); btMapTrackVeryEasy.setIcon( new javax.swing.ImageIcon(getClass().getResource("/course_generator/images/track_very_easy.png"))); btMapTrackVeryEasy.setToolTipText(bundle.getString("frmMain.btMapTrackVeryEasy.toolTipText")); btMapTrackVeryEasy.setFocusable(false); btMapTrackVeryEasy.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { // btOpenCGXActionPerformed(evt); //TODO } }); btMapTrackVeryEasy.setEnabled(false); jToolBarMapViewer.add(btMapTrackVeryEasy); // -- Track easy btMapTrackEasy = new javax.swing.JButton(); btMapTrackEasy.setIcon( new javax.swing.ImageIcon(getClass().getResource("/course_generator/images/track_easy.png"))); btMapTrackEasy.setToolTipText(bundle.getString("frmMain.btMapTrackEasy.toolTipText")); btMapTrackEasy.setFocusable(false); btMapTrackEasy.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { // btOpenCGXActionPerformed(evt); //TODO } }); btMapTrackEasy.setEnabled(false); jToolBarMapViewer.add(btMapTrackEasy); // -- Track average btMapTrackAverage = new javax.swing.JButton(); btMapTrackAverage.setIcon( new javax.swing.ImageIcon(getClass().getResource("/course_generator/images/track_average.png"))); btMapTrackAverage.setToolTipText(bundle.getString("frmMain.btMapTrackAverage.toolTipText")); btMapTrackAverage.setFocusable(false); btMapTrackAverage.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { // btOpenCGXActionPerformed(evt); //TODO } }); btMapTrackAverage.setEnabled(false); jToolBarMapViewer.add(btMapTrackAverage); // -- Track hard btMapTrackHard = new javax.swing.JButton(); btMapTrackHard.setIcon( new javax.swing.ImageIcon(getClass().getResource("/course_generator/images/track_hard.png"))); btMapTrackHard.setToolTipText(bundle.getString("frmMain.btMapTrackHard.toolTipText")); btMapTrackHard.setFocusable(false); btMapTrackHard.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { // btOpenCGXActionPerformed(evt); //TODO } }); btMapTrackHard.setEnabled(false); jToolBarMapViewer.add(btMapTrackHard); // -- Track average btMapTrackVeryHard = new javax.swing.JButton(); btMapTrackVeryHard.setIcon( new javax.swing.ImageIcon(getClass().getResource("/course_generator/images/track_very_hard.png"))); btMapTrackVeryHard.setToolTipText(bundle.getString("frmMain.btMapTrackVeryHard.toolTipText")); btMapTrackVeryHard.setFocusable(false); btMapTrackVeryHard.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { // btOpenCGXActionPerformed(evt); //TODO } }); btMapTrackVeryHard.setEnabled(false); jToolBarMapViewer.add(btMapTrackVeryHard); // -- Separator jToolBarMapViewer.add(new javax.swing.JToolBar.Separator()); // -- Mark btMapMark = new javax.swing.JButton(); btMapMark.setIcon(new javax.swing.ImageIcon(getClass().getResource("/course_generator/images/flag.png"))); btMapMark.setToolTipText(bundle.getString("frmMain.btMapMark.toolTipText")); btMapMark.setFocusable(false); btMapMark.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { // btOpenCGXActionPerformed(evt); //TODO } }); btMapMark.setEnabled(false); jToolBarMapViewer.add(btMapMark); // -- Eat btMapEat = new javax.swing.JButton(); btMapEat.setIcon(new javax.swing.ImageIcon(getClass().getResource("/course_generator/images/eat.png"))); btMapEat.setToolTipText(bundle.getString("frmMain.btMapEat.toolTipText")); btMapEat.setFocusable(false); btMapEat.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { // btOpenCGXActionPerformed(evt); //TODO } }); btMapEat.setEnabled(false); jToolBarMapViewer.add(btMapEat); // -- Drink btMapDrink = new javax.swing.JButton(); btMapDrink.setIcon(new javax.swing.ImageIcon(getClass().getResource("/course_generator/images/drink.png"))); btMapDrink.setToolTipText(bundle.getString("frmMain.btMapDrink.toolTipText")); btMapDrink.setFocusable(false); btMapDrink.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { // btOpenCGXActionPerformed(evt); //TODO } }); btMapDrink.setEnabled(false); jToolBarMapViewer.add(btMapDrink); }
From source file:org.broad.igv.cbio.FilterGeneNetworkUI.java
private void initComponents() { // JFormDesigner - Component initialization - DO NOT MODIFY //GEN-BEGIN:initComponents // Generated using JFormDesigner non-commercial license tabbedPane = new JTabbedPane(); dialogPane = new JPanel(); panel1 = new JPanel(); addRow = new JButton(); contentPane = new JPanel(); scrollPane1 = new JScrollPane(); geneTable = new JTable(); buttonBar = new JPanel(); totNumGenes = new JLabel(); keepIsolated = new JCheckBox(); okButton = new JButton(); refFilter = new JButton(); cancelButton = new JButton(); helpButton = new JButton(); saveButton = new JButton(); thresholds = new JPanel(); contentPanel = new JPanel(); label2 = new JLabel(); label3 = new JLabel(); delInput = new JTextField(); label4 = new JLabel(); expUpInput = new JTextField(); label7 = new JLabel(); expDownInput = new JTextField(); ampInput = new JTextField(); label1 = new JLabel(); mutInput = new JTextField(); label6 = new JLabel(); label8 = new JLabel(); separator1 = new JSeparator(); separator3 = new JSeparator(); separator2 = new JSeparator(); panel2 = new JPanel(); textArea1 = new JTextArea(); //======== this ======== setMinimumSize(new Dimension(600, 22)); setModalityType(Dialog.ModalityType.DOCUMENT_MODAL); Container contentPane2 = getContentPane(); contentPane2.setLayout(new BorderLayout()); //======== tabbedPane ======== {//w ww .j a va 2 s . com tabbedPane.setPreferredSize(new Dimension(550, 346)); tabbedPane.setMinimumSize(new Dimension(550, 346)); tabbedPane.addChangeListener(new ChangeListener() { @Override public void stateChanged(ChangeEvent e) { tabbedPaneStateChanged(e); } }); //======== dialogPane ======== { dialogPane.setBorder(new EmptyBorder(12, 12, 12, 12)); dialogPane.setMinimumSize(new Dimension(443, 300)); dialogPane.setPreferredSize(new Dimension(443, 300)); dialogPane.setLayout(new GridBagLayout()); ((GridBagLayout) dialogPane.getLayout()).columnWidths = new int[] { 0, 0 }; ((GridBagLayout) dialogPane.getLayout()).rowHeights = new int[] { 0, 0, 0, 0, 0, 0 }; ((GridBagLayout) dialogPane.getLayout()).columnWeights = new double[] { 1.0, 1.0E-4 }; ((GridBagLayout) dialogPane.getLayout()).rowWeights = new double[] { 0.0, 0.0, 1.0, 0.0, 0.0, 1.0E-4 }; //======== panel1 ======== { panel1.setLayout(new GridBagLayout()); ((GridBagLayout) panel1.getLayout()).columnWidths = new int[] { 0, 0, 0 }; ((GridBagLayout) panel1.getLayout()).rowHeights = new int[] { 0, 0 }; ((GridBagLayout) panel1.getLayout()).columnWeights = new double[] { 0.0, 0.0, 1.0E-4 }; ((GridBagLayout) panel1.getLayout()).rowWeights = new double[] { 0.0, 1.0E-4 }; //---- addRow ---- addRow.setText("Add Filter"); addRow.setMaximumSize(new Dimension(200, 28)); addRow.setMinimumSize(new Dimension(100, 28)); addRow.setPreferredSize(new Dimension(150, 28)); addRow.setVisible(false); addRow.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { addRowActionPerformed(e); } }); panel1.add(addRow, new GridBagConstraints(0, 0, 2, 1, 0.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.BOTH, new Insets(0, 0, 0, 0), 0, 0)); } dialogPane.add(panel1, new GridBagConstraints(0, 0, 1, 1, 0.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.BOTH, new Insets(0, 0, 0, 0), 0, 0)); //======== contentPane ======== { contentPane.setLayout(new BoxLayout(contentPane, BoxLayout.Y_AXIS)); } dialogPane.add(contentPane, new GridBagConstraints(0, 1, 1, 1, 0.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.BOTH, new Insets(0, 0, 0, 0), 0, 0)); //======== scrollPane1 ======== { //---- geneTable ---- geneTable.setAutoCreateRowSorter(true); scrollPane1.setViewportView(geneTable); } dialogPane.add(scrollPane1, new GridBagConstraints(0, 2, 1, 1, 0.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.BOTH, new Insets(0, 0, 0, 0), 0, 0)); //======== buttonBar ======== { buttonBar.setBorder(new EmptyBorder(12, 0, 0, 0)); buttonBar.setLayout(new GridBagLayout()); ((GridBagLayout) buttonBar.getLayout()).columnWidths = new int[] { 0, 85, 85, 80 }; ((GridBagLayout) buttonBar.getLayout()).columnWeights = new double[] { 1.0, 0.0, 0.0, 0.0 }; //---- totNumGenes ---- totNumGenes.setText("Total Genes: #"); buttonBar.add(totNumGenes, new GridBagConstraints(0, 0, 2, 1, 0.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.BOTH, new Insets(0, 0, 5, 5), 0, 0)); //---- keepIsolated ---- keepIsolated.setText("Keep Isolated Genes"); keepIsolated.setVisible(false); buttonBar.add(keepIsolated, new GridBagConstraints(0, 3, 2, 1, 0.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.BOTH, new Insets(0, 0, 5, 5), 0, 0)); //---- okButton ---- okButton.setText("View Network"); okButton.setToolTipText("Display the network in a web browser"); okButton.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { okButtonActionPerformed(e); } }); buttonBar.add(okButton, new GridBagConstraints(0, 4, 1, 1, 0.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.BOTH, new Insets(0, 0, 0, 5), 0, 0)); //---- refFilter ---- refFilter.setText("Refresh Filter"); refFilter.setVisible(false); refFilter.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { refFilterActionPerformed(e); } }); buttonBar.add(refFilter, new GridBagConstraints(1, 2, 1, 1, 0.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.BOTH, new Insets(0, 0, 5, 5), 0, 0)); //---- cancelButton ---- cancelButton.setText("Cancel"); cancelButton.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { cancelButtonActionPerformed(e); } }); buttonBar.add(cancelButton, new GridBagConstraints(3, 4, 1, 1, 0.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.BOTH, new Insets(0, 0, 0, 0), 0, 0)); //---- helpButton ---- helpButton.setText("Help"); helpButton.setVisible(false); buttonBar.add(helpButton, new GridBagConstraints(3, 2, 1, 1, 0.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.BOTH, new Insets(0, 0, 5, 0), 0, 0)); //---- saveButton ---- saveButton.setText("Save Table"); saveButton.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { saveButtonActionPerformed(e); } }); buttonBar.add(saveButton, new GridBagConstraints(1, 4, 1, 1, 0.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.BOTH, new Insets(0, 0, 0, 5), 0, 0)); } dialogPane.add(buttonBar, new GridBagConstraints(0, 3, 1, 1, 0.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.BOTH, new Insets(0, 0, 0, 0), 0, 0)); } tabbedPane.addTab("Filter", dialogPane); //======== thresholds ======== { thresholds.setPreferredSize(new Dimension(550, 196)); thresholds.setMinimumSize(new Dimension(550, 196)); thresholds.setLayout(null); //======== contentPanel ======== { contentPanel.setBorder(new EtchedBorder()); contentPanel.setLayout(null); //---- label2 ---- label2.setText("Amplification:"); label2.setHorizontalAlignment(SwingConstants.RIGHT); label2.setLabelFor(ampInput); label2.setToolTipText("Amplification score, on a log-normalized scale"); label2.setPreferredSize(new Dimension(90, 18)); contentPanel.add(label2); label2.setBounds(140, 96, label2.getPreferredSize().width, 18); //---- label3 ---- label3.setText("Deletion:"); label3.setHorizontalAlignment(SwingConstants.RIGHT); label3.setLabelFor(delInput); label3.setToolTipText("Deletion score, on a log-normalized scale"); label3.setPreferredSize(new Dimension(60, 16)); contentPanel.add(label3); label3.setBounds(360, 96, label3.getPreferredSize().width, 18); //---- delInput ---- delInput.setText("0.7"); delInput.setMinimumSize(new Dimension(34, 28)); delInput.setPreferredSize(new Dimension(45, 28)); delInput.setMaximumSize(new Dimension(50, 2147483647)); contentPanel.add(delInput); delInput.setBounds(new Rectangle(new Point(240, 162), delInput.getPreferredSize())); //---- label4 ---- label4.setText("Up:"); label4.setHorizontalAlignment(SwingConstants.RIGHT); label4.setLabelFor(expUpInput); label4.setToolTipText("Expression score, log-normalized scale"); label4.setPreferredSize(new Dimension(100, 18)); contentPanel.add(label4); label4.setBounds(130, 168, label4.getPreferredSize().width, 18); //---- expUpInput ---- expUpInput.setText("0.1"); expUpInput.setMinimumSize(new Dimension(34, 28)); expUpInput.setPreferredSize(new Dimension(45, 28)); contentPanel.add(expUpInput); expUpInput.setBounds(new Rectangle(new Point(430, 91), expUpInput.getPreferredSize())); //---- label7 ---- label7.setText("Down:"); label7.setHorizontalAlignment(SwingConstants.RIGHT); label7.setLabelFor(expDownInput); label7.setToolTipText("Expression score, log-normalized scale"); label7.setPreferredSize(new Dimension(120, 16)); contentPanel.add(label7); label7.setBounds(300, 168, label7.getPreferredSize().width, 18); //---- expDownInput ---- expDownInput.setText("0.1"); expDownInput.setPreferredSize(new Dimension(45, 28)); expDownInput.setMinimumSize(new Dimension(34, 28)); expDownInput.setMaximumSize(new Dimension(50, 2147483647)); contentPanel.add(expDownInput); expDownInput.setBounds(new Rectangle(new Point(430, 162), expDownInput.getPreferredSize())); //---- ampInput ---- ampInput.setText("0.7"); ampInput.setMinimumSize(new Dimension(34, 28)); ampInput.setPreferredSize(new Dimension(45, 28)); contentPanel.add(ampInput); ampInput.setBounds(new Rectangle(new Point(240, 91), ampInput.getPreferredSize())); //---- label1 ---- label1.setText("Mutation:"); label1.setHorizontalAlignment(SwingConstants.RIGHT); label1.setLabelFor(mutInput); label1.setToolTipText("Minimum number of mutations found"); label1.setPreferredSize(new Dimension(66, 18)); contentPanel.add(label1); label1.setBounds(50, 26, label1.getPreferredSize().width, 18); //---- mutInput ---- mutInput.setText("1"); mutInput.setAutoscrolls(false); mutInput.setMinimumSize(new Dimension(34, 28)); mutInput.setPreferredSize(new Dimension(45, 28)); contentPanel.add(mutInput); mutInput.setBounds(new Rectangle(new Point(240, 21), mutInput.getPreferredSize())); //---- label6 ---- label6.setText("Copy Number:"); contentPanel.add(label6); label6.setBounds(30, 96, label6.getPreferredSize().width, 18); //---- label8 ---- label8.setText("Expression:"); label8.setHorizontalAlignment(SwingConstants.RIGHT); contentPanel.add(label8); label8.setBounds(30, 168, 86, 18); contentPanel.add(separator1); separator1.setBounds(0, 135, 500, 10); contentPanel.add(separator3); separator3.setBounds(0, 65, 500, 10); //---- separator2 ---- separator2.setPreferredSize(new Dimension(10, 210)); separator2.setOrientation(SwingConstants.VERTICAL); contentPanel.add(separator2); separator2.setBounds(new Rectangle(new Point(120, 0), separator2.getPreferredSize())); { // compute preferred size Dimension preferredSize = new Dimension(); for (int i = 0; i < contentPanel.getComponentCount(); i++) { Rectangle bounds = contentPanel.getComponent(i).getBounds(); preferredSize.width = Math.max(bounds.x + bounds.width, preferredSize.width); preferredSize.height = Math.max(bounds.y + bounds.height, preferredSize.height); } Insets insets = contentPanel.getInsets(); preferredSize.width += insets.right; preferredSize.height += insets.bottom; contentPanel.setMinimumSize(preferredSize); contentPanel.setPreferredSize(preferredSize); } } thresholds.add(contentPanel); contentPanel.setBounds(12, 80, 500, 210); //======== panel2 ======== { panel2.setLayout(null); { // compute preferred size Dimension preferredSize = new Dimension(); for (int i = 0; i < panel2.getComponentCount(); i++) { Rectangle bounds = panel2.getComponent(i).getBounds(); preferredSize.width = Math.max(bounds.x + bounds.width, preferredSize.width); preferredSize.height = Math.max(bounds.y + bounds.height, preferredSize.height); } Insets insets = panel2.getInsets(); preferredSize.width += insets.right; preferredSize.height += insets.bottom; panel2.setMinimumSize(preferredSize); panel2.setPreferredSize(preferredSize); } } thresholds.add(panel2); panel2.setBounds(new Rectangle(new Point(55, 25), panel2.getPreferredSize())); //---- textArea1 ---- textArea1.setText( "Samples are considered to have a given \"event\" if the value is above the thresholds below."); textArea1.setEditable(false); textArea1.setLineWrap(true); textArea1.setBackground(UIManager.getColor("Button.background")); thresholds.add(textArea1); textArea1.setBounds(15, 10, 430, 40); { // compute preferred size Dimension preferredSize = new Dimension(); for (int i = 0; i < thresholds.getComponentCount(); i++) { Rectangle bounds = thresholds.getComponent(i).getBounds(); preferredSize.width = Math.max(bounds.x + bounds.width, preferredSize.width); preferredSize.height = Math.max(bounds.y + bounds.height, preferredSize.height); } Insets insets = thresholds.getInsets(); preferredSize.width += insets.right; preferredSize.height += insets.bottom; thresholds.setMinimumSize(preferredSize); thresholds.setPreferredSize(preferredSize); } } tabbedPane.addTab("Thresholds", thresholds); } contentPane2.add(tabbedPane, BorderLayout.NORTH); pack(); setLocationRelativeTo(getOwner()); // JFormDesigner - End of component initialization //GEN-END:initComponents }
From source file:org.intermine.install.swing.source.SourcePropertiesPanel.java
/** * Get the increment for scrolling this panel by block. * //w ww . j a va 2s . co m * @param visibleRect The view area visible in the viewport. * @param orientation The orientation. * @param direction The direction of scrolling. * * @return The amount to scroll * * @see Scrollable#getScrollableBlockIncrement */ @Override public int getScrollableBlockIncrement(Rectangle visibleRect, int orientation, int direction) { switch (orientation) { case SwingConstants.VERTICAL: return visibleRect.height; case SwingConstants.HORIZONTAL: return visibleRect.width; default: throw new IllegalArgumentException("Invalid orientation: " + orientation); } }
From source file:org.intermine.install.swing.source.SourcePropertiesPanel.java
/** * Get the increment for scrolling this panel by unit. * // w ww. j a v a2s. c o m * @param visibleRect The view area visible in the viewport. * @param orientation The orientation. * @param direction The direction of scrolling. * * @return The amount to scroll * * @see Scrollable#getScrollableUnitIncrement */ @Override public int getScrollableUnitIncrement(Rectangle visibleRect, int orientation, int direction) { switch (orientation) { case SwingConstants.VERTICAL: return visibleRect.height / 10; case SwingConstants.HORIZONTAL: return visibleRect.width / 10; default: throw new IllegalArgumentException("Invalid orientation: " + orientation); } }
From source file:org.jcurl.demo.tactics.TacticsApp.java
public TacticsApp() { addWindowListener(new WindowAdapter() { public void windowClosing(WindowEvent e) { TacticsApp.this.cmdExit(); }//from w w w . jav a2 s . com }); master = new RockEditDisplay(); master.setPos(mod_locations); master.setSpeed(mod_speeds); final PositionDisplay pnl2 = new PositionDisplay(); pnl2.setPos(mod_locations); pnl2.setZoom(Zoomer.HOG2HACK); final Container con = getContentPane(); { final JPanel p = new JPanel(new BorderLayout()); p.add(new SumWaitDisplay(mod_locations), "West"); p.add(master, "Center"); p.add(new SumShotDisplay(mod_locations), "East"); con.add(p, "Center"); } // con.add(new SumWaitDisplay(mod_locations), "West"); con.add(new SumOutDisplay(mod_locations), "West"); { final Box b1 = Box.createHorizontalBox(); b1.add(Box.createRigidArea(new Dimension(0, 75))); b1.add(pnl2); con.add(b1, "South"); } final JTabbedPane t = new JTabbedPane(); con.add(t, "East"); { final Box b0 = Box.createHorizontalBox(); t.add("Rock", b0); { final JPanel b1 = new JPanel(new BorderLayout()); final Box b2 = Box.createVerticalBox(); b2.add(new JComboBox(new String[] { "Dark", "Light" })); b2.add(new JLabel("Broom", SwingConstants.LEFT)); b1.add(b2, "North"); JSlider s = new JSlider(-2000, 2000, 0); s.setOrientation(SwingConstants.VERTICAL); s.setMajorTickSpacing(1000); s.setMinorTickSpacing(100); s.setPaintLabels(true); s.setPaintTicks(true); b1.add(s, "Center"); final Box b3 = Box.createHorizontalBox(); b3.add(new JFormattedTextField()); b3.add(new JLabel("mm", SwingConstants.LEFT)); b1.add(b3, "South"); b0.add(b1); } { final JPanel b1 = new JPanel(new BorderLayout()); final Box b2 = Box.createVerticalBox(); b2.add(new JComboBox(new String[] { "1", "2", "3", "4", "5", "6", "7", "8" })); b2.add(new JLabel("Splittime", SwingConstants.LEFT)); b1.add(b2, "North"); JSlider s = new JSlider(500, 2500, 1500); s.setOrientation(SwingConstants.VERTICAL); s.setMajorTickSpacing(1000); s.setMinorTickSpacing(100); s.setPaintLabels(true); s.setPaintTicks(true); b1.add(s, "Center"); final Box b3 = Box.createHorizontalBox(); b3.add(new JSpinner()); b3.add(new JLabel("ms", SwingConstants.LEFT)); b1.add(b3, "South"); b0.add(b1); } } { final Box b0 = Box.createHorizontalBox(); t.add("Ice", b0); { final JPanel b1 = new JPanel(new BorderLayout()); b1.add(new JLabel("Curl"), "North"); JSlider s = new JSlider(0, 5000, 0); s.setOrientation(SwingConstants.VERTICAL); s.setMajorTickSpacing(1000); s.setMinorTickSpacing(100); s.setPaintLabels(true); s.setPaintTicks(true); b1.add(s, "Center"); final JSpinner s1 = new JSpinner(); b1.add(s1, "South"); b0.add(b1); } { final JPanel b1 = new JPanel(new BorderLayout()); b1.add(new JLabel("DrawToTee"), "North"); JSlider s = new JSlider(15000, 30000, 25000); s.setOrientation(SwingConstants.VERTICAL); s.setMajorTickSpacing(5000); s.setMinorTickSpacing(1000); s.setPaintLabels(true); s.setPaintTicks(true); b1.add(s, "Center"); final JSpinner s1 = new JSpinner(); b1.add(s1, "South"); b0.add(b1); } } setJMenuBar(createMenu()); refreshTitle(); this.setSize(900, 400); new SpeedController(mod_locations, mod_speeds, master); new LocationController(mod_locations, pnl2); lastSaved = mod_locations.getLastChanged(); }
From source file:org.jcurl.mr.gui.BroomPanel0.java
public BroomPanel0(final Model m) { model = m == null ? new Model() : m; model.addPropertyChangeListener(this); setVisible(false);/*w w w .j a v a 2 s. c o m*/ setLayout(new BorderLayout()); final JLabel label; this.add(label = new JLabel(), "North"); label.setText("Broom"); label.setHorizontalAlignment(SwingConstants.CENTER); this.add(slider = new JSlider(), "Center"); slider.setOrientation(SwingConstants.VERTICAL); final int max = (int) (new Measure(IceSize.SIDE_2_CENTER, Unit.METER).to(dim).value * Granularity); slider.setMaximum((int) (Granularity * Math.ceil((double) max / Granularity))); // slider.setMaximum(2500); slider.setMinimum(-slider.getMaximum()); slider.setMajorTickSpacing(Granularity); slider.setMinorTickSpacing(Granularity / 10); slider.setAlignmentX(10); slider.setPaintLabels(true); slider.setPaintTicks(true); slider.setPaintTrack(true); slider.addChangeListener(this); this.add(text = new JTextField(), "South"); text.setHorizontalAlignment(SwingConstants.CENTER); text.setEditable(true); text.addActionListener(this); text.selectAll(); this.setSize(50, 100); model.setBroomX(new Measure(0, dim)); setVisible(true); }
From source file:org.nuclos.client.ui.DateTimeSeries.java
/** * - creates the panels//from w ww. j a va2s . co m * - set properties and actionlisteners to all controls * - add all controls to the panels */ private synchronized void setupControl() { this.setLayout(new BorderLayout()); final double[] columns = new double[] { 2.0, TableLayout.PREFERRED, TableLayout.PREFERRED, TableLayout.PREFERRED, 2.0 }; final double[] rows = new double[] { 4.0, 28.0, 28.0, 28.0, 28.0, 28.0, 4.0 }; tfTimeH.setInputVerifier(new TextFieldNumberVerifier(0, 23)); tfTimeH.setColumns(2); tfTimeM.setInputVerifier(new TextFieldNumberVerifier(0, 59)); tfTimeM.setColumns(2); final JPanel pnlHolder = new JPanel(); pnlHolder.setLayout(new TableLayout(columns, rows)); pnlHolder.setBorder(tfSeries.getBorder()); radioDaily.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { setMode(DAILY_MODE); } }); radioWeekly.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { setMode(WEEKLY_MODE); } }); radioMonthly.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { setMode(MONTHLY_MODE); } }); radioYearly.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { setMode(YEARLY_MODE); } }); radioNoMode.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { setMode(NO_MODE); } }); bgMainModus.add(radioDaily); bgMainModus.add(radioWeekly); bgMainModus.add(radioMonthly); bgMainModus.add(radioYearly); bgMainModus.add(radioNoMode); pnlHolder.add(radioDaily, getConstraints(1, 1, 1, 1)); pnlHolder.add(radioWeekly, getConstraints(1, 1, 2, 2)); pnlHolder.add(radioMonthly, getConstraints(1, 1, 3, 3)); pnlHolder.add(radioYearly, getConstraints(1, 1, 4, 4)); if (isNoModeAvaiable) { pnlHolder.add(radioNoMode, getConstraints(1, 1, 5, 5)); } pnlHolder.add(new JSeparator(SwingConstants.VERTICAL), getConstraints(2, 2, 1, 5, TableLayoutConstants.CENTER, TableLayoutConstants.FULL)); final JLabel labStartTime = new JLabel("Uhrzeit "); constraintsPnlTime = getConstraints(1, 4, 1, 1); pnlTime = new JPanel(new TableLayout( new double[] { 2.0, TableLayoutConstants.PREFERRED, TableLayoutConstants.PREFERRED, TableLayoutConstants.PREFERRED, TableLayoutConstants.PREFERRED, 2.0 }, new double[] { 4.0, 21.0, 4.0 })); pnlTime.add(labStartTime, getConstraints(1, 1, 1, 1)); pnlTime.add(tfTimeH, getConstraints(2, 2, 1, 1)); pnlTime.add(new JLabel(" : "), getConstraints(3, 3, 1, 1)); pnlTime.add(tfTimeM, getConstraints(4, 4, 1, 1)); final TableLayoutConstraints constraintsRight = getConstraints(3, 3, 1, 5, TableLayoutConstants.FULL, TableLayoutConstants.FULL); pnlEmpty = new JPanel(new TableLayout()); pnlHolder.add(pnlEmpty, constraintsRight); /** * DAILY MODE */ pnlDailyMode = new JPanel(new TableLayout( new double[] { 4.0, TableLayoutConstants.PREFERRED, TableLayoutConstants.PREFERRED, TableLayoutConstants.PREFERRED, 4.0 }, new double[] { 4.0, TableLayoutConstants.PREFERRED, // for start time panel 21.0, 21.0, 4.0 })); tfDailyDays.setColumns(4); tfDailyDays.setInputVerifier(new TextFieldNumberVerifier(1, 366)); radioDailyAll.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { tfDailyDays.setEnabled(true); } }); radioDailyWorking.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { tfDailyDays.setEnabled(false); } }); final ButtonGroup bgDailyMode = new ButtonGroup(); bgDailyMode.add(this.radioDailyAll); bgDailyMode.add(this.radioDailyWorking); radioDailyAll.addActionListener(this); radioDailyWorking.addActionListener(this); pnlDailyMode.add(radioDailyAll, getConstraints(1, 1, 2, 2)); pnlDailyMode.add(radioDailyWorking, getConstraints(1, 3, 3, 3)); pnlDailyMode.add(tfDailyDays, getConstraints(2, 2, 2, 2)); pnlDailyMode.add(new JLabel(" Tag(e)"), getConstraints(3, 3, 2, 2)); pnlHolder.add(pnlDailyMode, constraintsRight); /** * WEEKLY MODE */ pnlWeeklyMode = new JPanel(new TableLayout( new double[] { 4.0, TableLayoutConstants.PREFERRED, TableLayoutConstants.PREFERRED, TableLayoutConstants.PREFERRED, 4.0 }, new double[] { 4.0, TableLayoutConstants.PREFERRED, // for start time panel 21.0, 21.0, 21.0, 21.0, 21.0, 4.0 })); tfWeeklyWeeks.setColumns(3); tfWeeklyWeeks.setInputVerifier(new TextFieldNumberVerifier(1, 53)); pnlWeeklyMode.add(new JLabel("Jede/Alle "), getConstraints(1, 1, 2, 2)); pnlWeeklyMode.add(tfWeeklyWeeks, getConstraints(2, 2, 2, 2)); pnlWeeklyMode.add(new JLabel(" Woche(n) am"), getConstraints(3, 3, 2, 2)); pnlWeeklyMode.add(checkMonday, getConstraints(1, 2, 3, 3)); pnlWeeklyMode.add(checkTuesday, getConstraints(1, 2, 4, 4)); pnlWeeklyMode.add(checkWednesday, getConstraints(1, 2, 5, 5)); pnlWeeklyMode.add(checkThursday, getConstraints(1, 2, 6, 6)); pnlWeeklyMode.add(checkFriday, getConstraints(3, 3, 3, 3)); pnlWeeklyMode.add(checkSaturday, getConstraints(3, 3, 4, 4)); pnlWeeklyMode.add(checkSunday, getConstraints(3, 3, 5, 5)); checkMonday.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { if (!isAtLeastOneWeekdaySelected()) checkMonday.setSelected(true); } }); checkMonday.addActionListener(this); checkTuesday.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { if (!isAtLeastOneWeekdaySelected()) checkTuesday.setSelected(true); } }); checkTuesday.addActionListener(this); checkWednesday.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { if (!isAtLeastOneWeekdaySelected()) checkWednesday.setSelected(true); } }); checkWednesday.addActionListener(this); checkThursday.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { if (!isAtLeastOneWeekdaySelected()) checkThursday.setSelected(true); } }); checkThursday.addActionListener(this); checkFriday.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { if (!isAtLeastOneWeekdaySelected()) checkFriday.setSelected(true); } }); checkFriday.addActionListener(this); checkSaturday.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { if (!isAtLeastOneWeekdaySelected()) checkSaturday.setSelected(true); } }); checkSaturday.addActionListener(this); checkSunday.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { if (!isAtLeastOneWeekdaySelected()) checkSunday.setSelected(true); } }); checkSunday.addActionListener(this); pnlHolder.add(pnlWeeklyMode, constraintsRight); /** * MONTHLY MODE */ pnlMonthlyMode = new JPanel(new TableLayout( new double[] { 4.0, TableLayoutConstants.PREFERRED, TableLayoutConstants.PREFERRED, TableLayoutConstants.PREFERRED, TableLayoutConstants.PREFERRED, TableLayoutConstants.PREFERRED, TableLayoutConstants.PREFERRED, 4.0 }, new double[] { 4.0, TableLayoutConstants.PREFERRED, // for start time panel 21.0, 21.0, 26.0, 21.0, 4.0 })); final ButtonGroup bgMonthlyMode = new ButtonGroup(); radioMonthly1.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { tfMonthly1Day.setEnabled(true); tfMonthly1Month.setEnabled(true); comboMonthly2Number.setEnabled(false); comboMonthly2Weekday.setEnabled(false); tfMonthly2Month.setEnabled(false); } }); radioMonthly1.addActionListener(this); radioMonthly2.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { tfMonthly1Day.setEnabled(false); tfMonthly1Month.setEnabled(false); comboMonthly2Number.setEnabled(true); comboMonthly2Weekday.setEnabled(true); tfMonthly2Month.setEnabled(true); } }); radioMonthly2.addActionListener(this); bgMonthlyMode.add(radioMonthly1); bgMonthlyMode.add(radioMonthly2); tfMonthly1Day.setColumns(3); tfMonthly1Day.setInputVerifier(new TextFieldNumberVerifier(1, 31)); tfMonthly1Month.setColumns(3); tfMonthly1Month.setInputVerifier(new TextFieldNumberVerifier(1, 12)); tfMonthly2Month.setColumns(3); tfMonthly2Month.setInputVerifier(new TextFieldNumberVerifier(1, 12)); comboMonthly2Number.addActionListener(this); for (SeriesListItem sli : SeriesUtils.getNumberItems()) { comboMonthly2Number.addItem(sli); } comboMonthly2Weekday.addActionListener(this); for (SeriesListItem sli : SeriesUtils.getWeekdayItems()) { comboMonthly2Weekday.addItem(sli); } pnlMonthlyMode.add(radioMonthly1, getConstraints(1, 1, 2, 2)); pnlMonthlyMode.add(radioMonthly2, getConstraints(1, 1, 4, 4, TableLayoutConstants.LEFT, TableLayoutConstants.BOTTOM)); pnlMonthlyMode.add(tfMonthly1Day, getConstraints(2, 2, 2, 2)); pnlMonthlyMode.add(new JLabel(" . Tag"), getConstraints(3, 3, 2, 2)); pnlMonthlyMode.add(new JLabel("jedes "), getConstraints(2, 2, 3, 3)); pnlMonthlyMode.add(tfMonthly1Month, getConstraints(3, 3, 3, 3)); pnlMonthlyMode.add(new JLabel(" . Monats"), getConstraints(4, 4, 3, 3)); pnlMonthlyMode.add(comboMonthly2Number, getConstraints(2, 3, 4, 4, TableLayoutConstants.LEFT, TableLayoutConstants.BOTTOM)); pnlMonthlyMode.add(comboMonthly2Weekday, getConstraints(4, 5, 4, 4, TableLayoutConstants.LEFT, TableLayoutConstants.BOTTOM)); pnlMonthlyMode.add(new JLabel("jedes "), getConstraints(2, 2, 5, 5)); pnlMonthlyMode.add(tfMonthly2Month, getConstraints(3, 3, 5, 5)); pnlMonthlyMode.add(new JLabel(" . Monats"), getConstraints(4, 4, 5, 5)); pnlHolder.add(pnlMonthlyMode, constraintsRight); /** * YEARLY MODE */ pnlYearlyMode = new JPanel(new TableLayout( new double[] { 4.0, TableLayoutConstants.PREFERRED, TableLayoutConstants.PREFERRED, TableLayoutConstants.PREFERRED, TableLayoutConstants.PREFERRED, TableLayoutConstants.PREFERRED, 4.0 }, new double[] { 4.0, TableLayoutConstants.PREFERRED, // for start time panel 21.0, 26.0, 21.0, 4.0 })); final ButtonGroup bgYearlyMode = new ButtonGroup(); radioYearly1.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { tfYearly1Day.setEnabled(true); comboYearly1Month.setEnabled(true); comboYearly2Number.setEnabled(false); comboYearly2Weekday.setEnabled(false); comboYearly2Month.setEnabled(false); } }); radioYearly1.addActionListener(this); radioYearly2.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { tfYearly1Day.setEnabled(false); comboYearly1Month.setEnabled(false); comboYearly2Number.setEnabled(true); comboYearly2Weekday.setEnabled(true); comboYearly2Month.setEnabled(true); } }); radioYearly2.addActionListener(this); bgYearlyMode.add(radioYearly1); bgYearlyMode.add(radioYearly2); tfYearly1Day.setColumns(3); tfYearly1Day.setInputVerifier(new TextFieldNumberVerifier(1, 31)); comboYearly1Month.addActionListener(this); for (SeriesListItem sli : SeriesUtils.getMonthItems()) { comboYearly1Month.addItem(sli); } comboYearly2Number.addActionListener(this); for (SeriesListItem sli : SeriesUtils.getNumberItems()) { comboYearly2Number.addItem(sli); } comboYearly2Weekday.addActionListener(this); for (SeriesListItem sli : SeriesUtils.getWeekdayItems()) { comboYearly2Weekday.addItem(sli); } comboYearly2Month.addActionListener(this); for (SeriesListItem sli : SeriesUtils.getMonthItems()) { comboYearly2Month.addItem(sli); } pnlYearlyMode.add(radioYearly1, getConstraints(1, 1, 2, 2)); pnlYearlyMode.add(radioYearly2, getConstraints(1, 1, 3, 3, TableLayoutConstants.LEFT, TableLayoutConstants.BOTTOM)); pnlYearlyMode.add(tfYearly1Day, getConstraints(2, 2, 2, 2)); pnlYearlyMode.add(new JLabel(" . "), getConstraints(3, 3, 2, 2)); pnlYearlyMode.add(comboYearly1Month, getConstraints(4, 5, 2, 2)); pnlYearlyMode.add(comboYearly2Number, getConstraints(2, 3, 3, 3, TableLayoutConstants.LEFT, TableLayoutConstants.BOTTOM)); pnlYearlyMode.add(comboYearly2Weekday, getConstraints(4, 5, 3, 3, TableLayoutConstants.LEFT, TableLayoutConstants.BOTTOM)); pnlYearlyMode.add(new JLabel("im "), getConstraints(2, 2, 4, 4)); pnlYearlyMode.add(comboYearly2Month, getConstraints(3, 5, 4, 4)); pnlHolder.add(pnlYearlyMode, constraintsRight); resetAllInputFieldsToDefault(); /* * add "Main" Panel */ this.add(pnlHolder, BorderLayout.CENTER); }
From source file:org.openmicroscopy.shoola.util.ui.UIUtilities.java
/** * Create a separator to add to a toolbar. The separator needs to be * set when the layout of the toolbar is reset. * /*w ww .ja v a 2s . co m*/ * @param button The button to add to the toolBar. The height of the * separator depends of the insets of the button. * @param icon The icon to add to the button. The height of the * separator depends of the height of the icon. * @return See below. */ public static JSeparator toolBarSeparator(JButton button, Icon icon) { JSeparator separator = new JSeparator(SwingConstants.VERTICAL); if (button == null) return separator; Insets i = button.getInsets(); int h = 0; if (icon != null) h = icon.getIconHeight(); Dimension d = new Dimension(SEPARATOR_WIDTH, i.top + h + i.bottom); separator.setPreferredSize(d); separator.setSize(d); return separator; }
From source file:org.tinymediamanager.ui.dialogs.ImageChooserDialog.java
/** * Instantiates a new image chooser dialog. * /*from w w w .j a va2s .co m*/ * @param ids * the ids * @param type * the type * @param artworkScrapers * the artwork providers * @param imageLabel * the image label * @param extraThumbs * the extra thumbs * @param extraFanarts * the extra fanarts * @param mediaType * the media for for which artwork has to be chosen */ public ImageChooserDialog(final HashMap<String, Object> ids, ImageType type, List<MediaScraper> artworkScrapers, ImageLabel imageLabel, List<String> extraThumbs, List<String> extraFanarts, MediaType mediaType) { super("", "imageChooser"); this.imageLabel = imageLabel; this.type = type; this.mediaType = mediaType; this.artworkScrapers = artworkScrapers; this.extraThumbs = extraThumbs; this.extraFanarts = extraFanarts; switch (type) { case FANART: setTitle(BUNDLE.getString("image.choose.fanart")); //$NON-NLS-1$ break; case POSTER: setTitle(BUNDLE.getString("image.choose.poster")); //$NON-NLS-1$ break; case BANNER: setTitle(BUNDLE.getString("image.choose.banner")); //$NON-NLS-1$ break; case SEASON: Object season = ids.get("tvShowSeason"); if (season != null) { setTitle(BUNDLE.getString("image.choose.season") + " - " + BUNDLE.getString("metatag.season") + " " //$NON-NLS-1$ + season); } else { setTitle(BUNDLE.getString("image.choose.season")); //$NON-NLS-1$ } break; case CLEARART: setTitle(BUNDLE.getString("image.choose.clearart")); //$NON-NLS-1$ break; case DISC: setTitle(BUNDLE.getString("image.choose.disc")); //$NON-NLS-1$ break; case LOGO: setTitle(BUNDLE.getString("image.choose.logo")); //$NON-NLS-1$ break; case CLEARLOGO: setTitle(BUNDLE.getString("image.choose.clearlogo")); //$NON-NLS-1$ break; case THUMB: setTitle(BUNDLE.getString("image.choose.thumb")); //$NON-NLS-1$ break; } setBounds(5, 5, 1000, 590); getContentPane().setLayout(new BorderLayout()); getContentPane().add(contentPanel, BorderLayout.CENTER); contentPanel.setLayout(new FormLayout( new ColumnSpec[] { FormFactory.LABEL_COMPONENT_GAP_COLSPEC, ColumnSpec.decode("258px:grow"), FormFactory.RELATED_GAP_COLSPEC, FormFactory.DEFAULT_COLSPEC, FormFactory.LABEL_COMPONENT_GAP_COLSPEC, }, new RowSpec[] { FormFactory.LINE_GAP_ROWSPEC, RowSpec.decode("fill:266px:grow"), FormFactory.RELATED_GAP_ROWSPEC, FormFactory.DEFAULT_ROWSPEC, FormFactory.RELATED_GAP_ROWSPEC, })); { scrollPane = new JScrollPane(); scrollPane.setHorizontalScrollBarPolicy(ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER); contentPanel.add(scrollPane, "2, 2, 3, 1, fill, fill"); { panelImages = new JPanel(); scrollPane.setViewportView(panelImages); scrollPane.getVerticalScrollBar().setUnitIncrement(16); panelImages.setLayout(new WrapLayout(FlowLayout.LEFT)); } } { tfImageUrl = new EnhancedTextField(BUNDLE.getString("image.inserturl")); //$NON-NLS-1$ contentPanel.add(tfImageUrl, "2, 4, fill, default"); tfImageUrl.setColumns(10); JButton btnAddImage = new JButton(BUNDLE.getString("image.downloadimage")); //$NON-NLS-1$ btnAddImage.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { if (StringUtils.isNotBlank(tfImageUrl.getText())) { downloadAndPreviewImage(tfImageUrl.getText()); } } }); contentPanel.add(btnAddImage, "4, 4"); } { JPanel bottomPane = new JPanel(); getContentPane().add(bottomPane, BorderLayout.SOUTH); bottomPane.setLayout(new FormLayout( new ColumnSpec[] { FormFactory.RELATED_GAP_COLSPEC, FormFactory.DEFAULT_COLSPEC, FormFactory.RELATED_GAP_COLSPEC, ColumnSpec.decode("default:grow"), FormFactory.RELATED_GAP_COLSPEC, FormFactory.DEFAULT_COLSPEC, FormFactory.RELATED_GAP_COLSPEC, }, new RowSpec[] { FormFactory.NARROW_LINE_GAP_ROWSPEC, FormFactory.DEFAULT_ROWSPEC, FormFactory.NARROW_LINE_GAP_ROWSPEC, RowSpec.decode("23px:grow"), FormFactory.RELATED_GAP_ROWSPEC, })); { if (type == ImageType.FANART && extraFanarts != null && extraThumbs != null) { JPanel panelExtraButtons = new JPanel(); bottomPane.add(panelExtraButtons, "2, 2, fill, bottom"); panelExtraButtons.setLayout(new FlowLayout(FlowLayout.LEFT, 2, 0)); { if (mediaType == MediaType.MOVIE && MovieModuleManager.MOVIE_SETTINGS.isImageExtraThumbs()) { JLabel labelThumbs = new JLabel("Extrathumbs:"); panelExtraButtons.add(labelThumbs); JButton btnMarkExtrathumbs = new JButton(""); btnMarkExtrathumbs.setMargin(new Insets(0, 0, 0, 0)); btnMarkExtrathumbs.setIcon(IconManager.CHECK_ALL); btnMarkExtrathumbs.setToolTipText(BUNDLE.getString("image.extrathumbs.markall")); //$NON-NLS-1$ btnMarkExtrathumbs.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent arg0) { for (JToggleButton button : buttons) { if (button .getClientProperty("MediaArtworkExtrathumb") instanceof JCheckBox) { JCheckBox chkbx = (JCheckBox) button .getClientProperty("MediaArtworkExtrathumb"); chkbx.setSelected(true); } } } }); panelExtraButtons.add(btnMarkExtrathumbs); JButton btnUnMarkExtrathumbs = new JButton(""); btnUnMarkExtrathumbs.setMargin(new Insets(0, 0, 0, 0)); btnUnMarkExtrathumbs.setIcon(IconManager.UNCHECK_ALL); btnUnMarkExtrathumbs.setToolTipText(BUNDLE.getString("image.extrathumbs.unmarkall")); //$NON-NLS-1$ btnUnMarkExtrathumbs.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent arg0) { for (JToggleButton button : buttons) { if (button .getClientProperty("MediaArtworkExtrathumb") instanceof JCheckBox) { JCheckBox chkbx = (JCheckBox) button .getClientProperty("MediaArtworkExtrathumb"); chkbx.setSelected(false); } } } }); panelExtraButtons.add(btnUnMarkExtrathumbs); } if (mediaType == MediaType.MOVIE && MovieModuleManager.MOVIE_SETTINGS.isImageExtraThumbs() && MovieModuleManager.MOVIE_SETTINGS.isImageExtraFanart()) { JSeparator separator = new JSeparator(SwingConstants.VERTICAL); separator.setPreferredSize(new Dimension(2, 16)); panelExtraButtons.add(separator); } if (mediaType == MediaType.MOVIE && MovieModuleManager.MOVIE_SETTINGS.isImageExtraFanart()) { JLabel labelFanart = new JLabel("Extrafanart:"); panelExtraButtons.add(labelFanart); JButton btnMarkExtrafanart = new JButton(""); btnMarkExtrafanart.setMargin(new Insets(0, 0, 0, 0)); btnMarkExtrafanart.setIcon(IconManager.CHECK_ALL); btnMarkExtrafanart.setToolTipText(BUNDLE.getString("image.extrafanart.markall")); //$NON-NLS-1$ btnMarkExtrafanart.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent arg0) { for (JToggleButton button : buttons) { if (button.getClientProperty( "MediaArtworkExtrafanart") instanceof JCheckBox) { JCheckBox chkbx = (JCheckBox) button .getClientProperty("MediaArtworkExtrafanart"); chkbx.setSelected(true); } } } }); panelExtraButtons.add(btnMarkExtrafanart); JButton btnUnMarkExtrafanart = new JButton(""); btnUnMarkExtrafanart.setMargin(new Insets(0, 0, 0, 0)); btnUnMarkExtrafanart.setIcon(IconManager.UNCHECK_ALL); btnUnMarkExtrafanart.setToolTipText(BUNDLE.getString("image.extrafanart.unmarkall")); //$NON-NLS-1$ btnUnMarkExtrafanart.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent arg0) { for (JToggleButton button : buttons) { if (button.getClientProperty( "MediaArtworkExtrafanart") instanceof JCheckBox) { JCheckBox chkbx = (JCheckBox) button .getClientProperty("MediaArtworkExtrafanart"); chkbx.setSelected(false); } } } }); panelExtraButtons.add(btnUnMarkExtrafanart); } } } } { progressBar = new JProgressBar(); bottomPane.add(progressBar, "2, 4"); } { lblProgressAction = new JLabel(""); bottomPane.add(lblProgressAction, "4, 4"); } { JPanel buttonPane = new JPanel(); EqualsLayout layout = new EqualsLayout(5); buttonPane.setLayout(layout); layout.setMinWidth(100); bottomPane.add(buttonPane, "6, 4, fill, top"); JButton okButton = new JButton(BUNDLE.getString("Button.ok")); //$NON-NLS-1$ okButton.setAction(actionOK); okButton.setActionCommand("OK"); buttonPane.add(okButton); getRootPane().setDefaultButton(okButton); JButton btnAddFile = new JButton(BUNDLE.getString("Button.addfile")); //$NON-NLS-1$ btnAddFile.setAction(actionLocalFile); buttonPane.add(btnAddFile); JButton cancelButton = new JButton(BUNDLE.getString("Button.cancel")); //$NON-NLS-1$ cancelButton.setAction(actionCancel); cancelButton.setActionCommand("Cancel"); buttonPane.add(cancelButton); } } task = new DownloadTask(ids, this.artworkScrapers); task.execute(); }
From source file:org.tinymediamanager.ui.settings.GeneralSettingsPanel.java
/** * Instantiates a new general settings panel. *//* w ww . j av a 2 s. c o m*/ public GeneralSettingsPanel() { setLayout(new FormLayout( new ColumnSpec[] { FormSpecs.RELATED_GAP_COLSPEC, ColumnSpec.decode("left:max(200px;min):grow"), FormSpecs.RELATED_GAP_COLSPEC, ColumnSpec.decode("max(200px;default):grow"), FormSpecs.RELATED_GAP_COLSPEC, }, new RowSpec[] { FormSpecs.RELATED_GAP_ROWSPEC, FormSpecs.DEFAULT_ROWSPEC, FormSpecs.RELATED_GAP_ROWSPEC, FormSpecs.DEFAULT_ROWSPEC, FormSpecs.RELATED_GAP_ROWSPEC, FormSpecs.DEFAULT_ROWSPEC, FormSpecs.RELATED_GAP_ROWSPEC, FormSpecs.DEFAULT_ROWSPEC, FormSpecs.RELATED_GAP_ROWSPEC, })); JPanel panelUI = new JPanel(); panelUI.setBorder(new TitledBorder(null, BUNDLE.getString("Settings.ui"), TitledBorder.LEADING, //$NON-NLS-1$ TitledBorder.TOP, null, null)); add(panelUI, "2, 2, 3, 1, fill, fill"); panelUI.setLayout(new FormLayout( new ColumnSpec[] { FormSpecs.RELATED_GAP_COLSPEC, FormSpecs.DEFAULT_COLSPEC, FormSpecs.RELATED_GAP_COLSPEC, ColumnSpec.decode("100dlu"), FormSpecs.RELATED_GAP_COLSPEC, ColumnSpec.decode("default:grow"), FormSpecs.UNRELATED_GAP_COLSPEC, FormSpecs.DEFAULT_COLSPEC, FormSpecs.UNRELATED_GAP_COLSPEC, FormSpecs.DEFAULT_COLSPEC, FormSpecs.RELATED_GAP_COLSPEC, FormSpecs.DEFAULT_COLSPEC, FormSpecs.RELATED_GAP_COLSPEC, ColumnSpec.decode("default:grow"), FormSpecs.RELATED_GAP_COLSPEC, }, new RowSpec[] { FormSpecs.RELATED_GAP_ROWSPEC, FormSpecs.DEFAULT_ROWSPEC, FormSpecs.RELATED_GAP_ROWSPEC, FormSpecs.DEFAULT_ROWSPEC, FormSpecs.RELATED_GAP_ROWSPEC, FormSpecs.DEFAULT_ROWSPEC, FormSpecs.RELATED_GAP_ROWSPEC, FormSpecs.DEFAULT_ROWSPEC, FormSpecs.RELATED_GAP_ROWSPEC, })); LocaleComboBox actualLocale = null; // cbLanguage = new JComboBox(Utils.getLanguages().toArray()); Locale settingsLang = Utils.getLocaleFromLanguage(Globals.settings.getLanguage()); for (Locale l : Utils.getLanguages()) { LocaleComboBox localeComboBox = new LocaleComboBox(l); locales.add(localeComboBox); if (l.equals(settingsLang)) { actualLocale = localeComboBox; } } JLabel lblUiLanguage = new JLabel(BUNDLE.getString("Settings.language")); panelUI.add(lblUiLanguage, "2, 2"); cbLanguage = new JComboBox(locales.toArray()); panelUI.add(cbLanguage, "4, 2"); if (actualLocale != null) { cbLanguage.setSelectedItem(actualLocale); } JSeparator separator = new JSeparator(); separator.setOrientation(SwingConstants.VERTICAL); panelUI.add(separator, "8, 2, 1, 7"); JLabel lblFontFamily = new JLabel(BUNDLE.getString("Settings.fontfamily")); //$NON-NLS-1$ panelUI.add(lblFontFamily, "10, 2, right, default"); GraphicsEnvironment env = GraphicsEnvironment.getLocalGraphicsEnvironment(); cbFontFamily = new JComboBox(env.getAvailableFontFamilyNames()); cbFontFamily.setSelectedItem(Globals.settings.getFontFamily()); int index = cbFontFamily.getSelectedIndex(); if (index < 0) { cbFontFamily.setSelectedItem("Dialog"); index = cbFontFamily.getSelectedIndex(); } if (index < 0) { cbFontFamily.setSelectedIndex(0); } panelUI.add(cbFontFamily, "12, 2, fill, default"); JLabel lblFontSize = new JLabel(BUNDLE.getString("Settings.fontsize")); //$NON-NLS-1$ panelUI.add(lblFontSize, "10, 4, right, default"); cbFontSize = new JComboBox(DEFAULT_FONT_SIZES); cbFontSize.setSelectedItem(Globals.settings.getFontSize()); index = cbFontSize.getSelectedIndex(); if (index < 0) { cbFontSize.setSelectedIndex(0); } panelUI.add(cbFontSize, "12, 4, fill, default"); JPanel panel = new JPanel(); panelUI.add(panel, "2, 6, 5, 1, fill, fill"); panel.setLayout(new FormLayout(new ColumnSpec[] { FormSpecs.DEFAULT_COLSPEC, FormSpecs.RELATED_GAP_COLSPEC, ColumnSpec.decode("100dlu"), FormSpecs.RELATED_GAP_COLSPEC, ColumnSpec.decode("default:grow"), }, new RowSpec[] { FormSpecs.DEFAULT_ROWSPEC, FormSpecs.LABEL_COMPONENT_GAP_ROWSPEC, FormSpecs.DEFAULT_ROWSPEC, })); JLabel lblMissingTranslation = new JLabel(BUNDLE.getString("tmm.helptranslate")); panel.add(lblMissingTranslation, "1, 1, 5, 1"); lblLinkTransifex = new LinkLabel("https://www.transifex.com/projects/p/tinymediamanager/"); panel.add(lblLinkTransifex, "1, 3, 5, 1"); lblLinkTransifex.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent arg0) { try { TmmUIHelper.browseUrl(lblLinkTransifex.getNormalText()); } catch (Exception e) { LOGGER.error(e.getMessage()); MessageManager.instance .pushMessage(new Message(MessageLevel.ERROR, lblLinkTransifex.getNormalText(), "message.erroropenurl", new String[] { ":", e.getLocalizedMessage() }));//$NON-NLS-2$ } } }); tpFontHint = new JTextPane(); tpFontHint.setOpaque(false); TmmFontHelper.changeFont(tpFontHint, 0.833); tpFontHint.setText(BUNDLE.getString("Settings.fonts.hint")); //$NON-NLS-1$ panelUI.add(tpFontHint, "10, 6, 5, 1"); lblLanguageHint = new JLabel(""); TmmFontHelper.changeFont(lblLanguageHint, Font.BOLD); panelUI.add(lblLanguageHint, "2, 8, 5, 1"); lblFontChangeHint = new JLabel(""); TmmFontHelper.changeFont(lblFontChangeHint, Font.BOLD); panelUI.add(lblFontChangeHint, "10, 8, 5, 1"); JPanel panelMemory = new JPanel(); panelMemory.setBorder(new TitledBorder(null, BUNDLE.getString("Settings.memoryborder"), //$NON-NLS-1$ TitledBorder.LEADING, TitledBorder.TOP, null, null)); add(panelMemory, "2, 4, fill, fill"); panelMemory.setLayout(new FormLayout( new ColumnSpec[] { FormFactory.RELATED_GAP_COLSPEC, FormFactory.DEFAULT_COLSPEC, FormFactory.RELATED_GAP_COLSPEC, ColumnSpec.decode("250px:grow(4)"), FormFactory.RELATED_GAP_COLSPEC, ColumnSpec.decode("max(20dlu;default)"), ColumnSpec.decode("left:default:grow(5)"), }, new RowSpec[] { FormFactory.DEFAULT_ROWSPEC, FormFactory.RELATED_GAP_ROWSPEC, RowSpec.decode("default:grow"), FormFactory.RELATED_GAP_ROWSPEC, })); JLabel lblMemoryT = new JLabel(BUNDLE.getString("Settings.memory")); //$NON-NLS-1$ panelMemory.add(lblMemoryT, "2, 1"); sliderMemory = new JSlider(); sliderMemory.setPaintLabels(true); sliderMemory.setPaintTicks(true); sliderMemory.setSnapToTicks(true); sliderMemory.setMajorTickSpacing(512); sliderMemory.setMinorTickSpacing(128); sliderMemory.setMinimum(256); sliderMemory.setMaximum(1536); sliderMemory.setValue(512); panelMemory.add(sliderMemory, "4, 1, fill, default"); lblMemory = new JLabel("512"); //$NON-NLS-1$ panelMemory.add(lblMemory, "6, 1, right, default"); JLabel lblMb = new JLabel("MB"); panelMemory.add(lblMb, "7, 1, left, default"); tpMemoryHint = new JTextPane(); tpMemoryHint.setOpaque(false); tpMemoryHint.setText(BUNDLE.getString("Settings.memory.hint")); //$NON-NLS-1$ TmmFontHelper.changeFont(tpMemoryHint, 0.833); panelMemory.add(tpMemoryHint, "2, 3, 6, 1, fill, fill"); JPanel panelProxySettings = new JPanel(); panelProxySettings.setBorder(new TitledBorder(null, BUNDLE.getString("Settings.proxy"), //$NON-NLS-1$ TitledBorder.LEADING, TitledBorder.TOP, null, null)); add(panelProxySettings, "4, 4, fill, fill"); panelProxySettings.setLayout(new FormLayout( new ColumnSpec[] { FormFactory.RELATED_GAP_COLSPEC, FormFactory.DEFAULT_COLSPEC, FormFactory.RELATED_GAP_COLSPEC, ColumnSpec.decode("default:grow"), }, new RowSpec[] { FormFactory.RELATED_GAP_ROWSPEC, FormFactory.DEFAULT_ROWSPEC, FormFactory.RELATED_GAP_ROWSPEC, FormFactory.DEFAULT_ROWSPEC, FormFactory.RELATED_GAP_ROWSPEC, FormFactory.DEFAULT_ROWSPEC, FormFactory.RELATED_GAP_ROWSPEC, FormFactory.DEFAULT_ROWSPEC, FormFactory.RELATED_GAP_ROWSPEC, })); JLabel lblProxyHost = new JLabel(BUNDLE.getString("Settings.proxyhost")); //$NON-NLS-1$ panelProxySettings.add(lblProxyHost, "2, 2, right, default"); tfProxyHost = new JTextField(); lblProxyHost.setLabelFor(tfProxyHost); panelProxySettings.add(tfProxyHost, "4, 2, fill, default"); tfProxyHost.setColumns(10); JLabel lblProxyPort = new JLabel(BUNDLE.getString("Settings.proxyport")); //$NON-NLS-1$ panelProxySettings.add(lblProxyPort, "2, 4, right, default"); tfProxyPort = new JTextField(); lblProxyPort.setLabelFor(tfProxyPort); panelProxySettings.add(tfProxyPort, "4, 4, fill, default"); tfProxyPort.setColumns(10); JLabel lblProxyUser = new JLabel(BUNDLE.getString("Settings.proxyuser")); //$NON-NLS-1$ panelProxySettings.add(lblProxyUser, "2, 6, right, default"); tfProxyUsername = new JTextField(); lblProxyUser.setLabelFor(tfProxyUsername); panelProxySettings.add(tfProxyUsername, "4, 6, fill, default"); tfProxyUsername.setColumns(10); JLabel lblProxyPassword = new JLabel(BUNDLE.getString("Settings.proxypass")); //$NON-NLS-1$ panelProxySettings.add(lblProxyPassword, "2, 8, right, default"); tfProxyPassword = new JPasswordField(); lblProxyPassword.setLabelFor(tfProxyPassword); panelProxySettings.add(tfProxyPassword, "4, 8, fill, default"); JPanel panelMediaPlayer = new JPanel(); panelMediaPlayer.setBorder( new TitledBorder(null, "MediaPlayer", TitledBorder.LEADING, TitledBorder.TOP, null, null)); add(panelMediaPlayer, "2, 6, fill, fill"); panelMediaPlayer.setLayout(new FormLayout( new ColumnSpec[] { FormSpecs.RELATED_GAP_COLSPEC, ColumnSpec.decode("default:grow"), FormSpecs.RELATED_GAP_COLSPEC, FormSpecs.DEFAULT_COLSPEC, FormSpecs.RELATED_GAP_COLSPEC, }, new RowSpec[] { FormSpecs.RELATED_GAP_ROWSPEC, FormSpecs.DEFAULT_ROWSPEC, FormSpecs.RELATED_GAP_ROWSPEC, FormSpecs.DEFAULT_ROWSPEC, FormSpecs.RELATED_GAP_ROWSPEC, })); tpMediaPlayer = new JTextPane(); tpMediaPlayer.setOpaque(false); TmmFontHelper.changeFont(tpMediaPlayer, 0.833); tpMediaPlayer.setText(BUNDLE.getString("Settings.mediaplayer.hint")); //$NON-NLS-1$ panelMediaPlayer.add(tpMediaPlayer, "2, 2, 3, 1, fill, fill"); tfMediaPlayer = new JTextField(); panelMediaPlayer.add(tfMediaPlayer, "2, 4, fill, default"); tfMediaPlayer.setColumns(10); btnSearchMediaPlayer = new JButton(BUNDLE.getString("Button.chooseplayer")); //$NON-NLS-1$ btnSearchMediaPlayer.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent arg0) { Path file = TmmUIHelper.selectFile(BUNDLE.getString("Button.chooseplayer")); //$NON-NLS-1$ if (file != null && Utils.isRegularFile(file) || Platform.isMac()) { tfMediaPlayer.setText(file.toAbsolutePath().toString()); } } }); panelMediaPlayer.add(btnSearchMediaPlayer, "4, 4"); JPanel panelCache = new JPanel(); panelCache.setBorder(new TitledBorder(null, BUNDLE.getString("Settings.cache"), TitledBorder.LEADING, //$NON-NLS-1$ TitledBorder.TOP, null, null)); add(panelCache, "4, 6, fill, fill"); panelCache.setLayout(new FormLayout( new ColumnSpec[] { FormSpecs.RELATED_GAP_COLSPEC, FormSpecs.DEFAULT_COLSPEC, FormSpecs.RELATED_GAP_COLSPEC, ColumnSpec.decode("default:grow"), FormSpecs.RELATED_GAP_COLSPEC, }, new RowSpec[] { FormSpecs.RELATED_GAP_ROWSPEC, FormSpecs.DEFAULT_ROWSPEC, FormSpecs.RELATED_GAP_ROWSPEC, FormSpecs.DEFAULT_ROWSPEC, FormSpecs.RELATED_GAP_ROWSPEC, })); chckbxImageCache = new JCheckBox(BUNDLE.getString("Settings.imagecache"));//$NON-NLS-1$ panelCache.add(chckbxImageCache, "2, 2, 3, 1"); JLabel lblImageCacheQuality = new JLabel(BUNDLE.getString("Settings.imagecachetype"));//$NON-NLS-1$ panelCache.add(lblImageCacheQuality, "2, 4, right, default"); cbImageCacheQuality = new JComboBox(ImageCache.CacheType.values()); panelCache.add(cbImageCacheQuality, "4, 4, fill, default"); JPanel panelAnalytics = new JPanel(); panelAnalytics.setBorder(new TitledBorder(null, BUNDLE.getString("Settings.analytics.border"), //$NON-NLS-1$ TitledBorder.LEADING, TitledBorder.TOP, null, null)); add(panelAnalytics, "2, 8, fill, fill"); panelAnalytics.setLayout(new FormLayout( new ColumnSpec[] { FormSpecs.RELATED_GAP_COLSPEC, ColumnSpec.decode("default:grow"), FormSpecs.RELATED_GAP_COLSPEC, }, new RowSpec[] { FormSpecs.RELATED_GAP_ROWSPEC, FormSpecs.DEFAULT_ROWSPEC, FormSpecs.RELATED_GAP_ROWSPEC, FormSpecs.DEFAULT_ROWSPEC, FormSpecs.LINE_GAP_ROWSPEC, })); chckbxAnalytics = new JCheckBox(BUNDLE.getString("Settings.analytics"));//$NON-NLS-1$ panelAnalytics.add(chckbxAnalytics, "2, 2"); JTextPane tpAnalyticsDescription = new JTextPane(); tpAnalyticsDescription.setText(BUNDLE.getString("Settings.analytics.desc"));//$NON-NLS-1$ tpAnalyticsDescription.setOpaque(false); panelAnalytics.add(tpAnalyticsDescription, "2, 4, fill, fill"); JPanel panelMisc = new JPanel(); panelMisc.setBorder(new TitledBorder(null, BUNDLE.getString("Settings.misc"), TitledBorder.LEADING, //$NON-NLS-1$ TitledBorder.TOP, null, null)); add(panelMisc, "4, 8, fill, fill"); panelMisc.setLayout(new FormLayout( new ColumnSpec[] { FormFactory.RELATED_GAP_COLSPEC, FormFactory.DEFAULT_COLSPEC, FormFactory.RELATED_GAP_COLSPEC, ColumnSpec.decode("default:grow"), FormFactory.RELATED_GAP_COLSPEC, }, new RowSpec[] { FormFactory.RELATED_GAP_ROWSPEC, FormFactory.DEFAULT_ROWSPEC, FormFactory.RELATED_GAP_ROWSPEC, })); chckbxDeleteTrash = new JCheckBox(BUNDLE.getString("Settings.deletetrash")); panelMisc.add(chckbxDeleteTrash, "2, 2, 3, 1"); initDataBindings(); initMemorySlider(); // listen to changes of the combo box ItemListener listener = new ItemListener() { public void itemStateChanged(ItemEvent e) { checkChanges(); } }; cbLanguage.addItemListener(listener); cbFontSize.addItemListener(listener); cbFontFamily.addItemListener(listener); }