List of usage examples for java.awt GridBagConstraints WEST
int WEST
To view the source code for java.awt GridBagConstraints WEST.
Click Source Link
From source file:com.att.aro.ui.view.videotab.VideoTab.java
/** * Create the panel./*from w ww. j a v a2s.c o m*/ */ public VideoTab(MainFrame aroView, IARODiagnosticsOverviewRoute overviewRoute) { super(); this.aroView = aroView; this.overviewRoute = overviewRoute; bpObservable = new AROModelObserver(); container = new JPanel(new BorderLayout()); String headerTitle = MessageFormat.format(ResourceBundleHelper.getMessageString("videoTab.title"), ApplicationConfig.getInstance().getAppBrandName(), ApplicationConfig.getInstance().getAppShortName()); container.add(UIComponent.getInstance().getLogoHeader(headerTitle), BorderLayout.NORTH); // Summaries, Manifest, Requests ImagePanel panel = new ImagePanel(null); panel.setLayout(new GridBagLayout()); panel.add(layoutDataPanel(), new GridBagConstraints(0, 0, 1, 1, 1.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.HORIZONTAL, new Insets(10, 10, 0, 10), 0, 0)); container.add(panel, BorderLayout.CENTER); setViewportView(container); getVerticalScrollBar().setUnitIncrement(10); getHorizontalScrollBar().setUnitIncrement(10); }
From source file:edu.harvard.mcz.imagecapture.ChangePasswordDialog.java
/** * This method initializes jContentPane//ww w.j av a 2s. c om * * @return javax.swing.JPanel */ private JPanel getJContentPane() { if (jContentPane == null) { GridBagConstraints gridBagConstraints10 = new GridBagConstraints(); gridBagConstraints10.gridx = 0; gridBagConstraints10.weightx = 0.0; gridBagConstraints10.weighty = 1.0; gridBagConstraints10.gridy = 6; GridBagConstraints gridBagConstraints9 = new GridBagConstraints(); gridBagConstraints9.gridx = 0; gridBagConstraints9.fill = GridBagConstraints.HORIZONTAL; gridBagConstraints9.gridwidth = 2; gridBagConstraints9.gridy = 4; jLabelResponse = new JLabel(); jLabelResponse.setText(""); GridBagConstraints gridBagConstraints8 = new GridBagConstraints(); gridBagConstraints8.fill = GridBagConstraints.BOTH; gridBagConstraints8.gridy = 3; gridBagConstraints8.weightx = 1.0; gridBagConstraints8.anchor = GridBagConstraints.WEST; gridBagConstraints8.gridx = 1; GridBagConstraints gridBagConstraints7 = new GridBagConstraints(); gridBagConstraints7.fill = GridBagConstraints.BOTH; gridBagConstraints7.gridy = 2; gridBagConstraints7.weightx = 1.0; gridBagConstraints7.anchor = GridBagConstraints.WEST; gridBagConstraints7.gridx = 1; GridBagConstraints gridBagConstraints6 = new GridBagConstraints(); gridBagConstraints6.fill = GridBagConstraints.BOTH; gridBagConstraints6.gridy = 1; gridBagConstraints6.weightx = 1.0; gridBagConstraints6.anchor = GridBagConstraints.WEST; gridBagConstraints6.gridx = 1; GridBagConstraints gridBagConstraints5 = new GridBagConstraints(); gridBagConstraints5.gridx = 0; gridBagConstraints5.anchor = GridBagConstraints.EAST; gridBagConstraints5.gridy = 5; GridBagConstraints gridBagConstraints4 = new GridBagConstraints(); gridBagConstraints4.gridx = 1; gridBagConstraints4.anchor = GridBagConstraints.CENTER; gridBagConstraints4.gridy = 5; GridBagConstraints gridBagConstraints3 = new GridBagConstraints(); gridBagConstraints3.gridx = 0; gridBagConstraints3.anchor = GridBagConstraints.EAST; gridBagConstraints3.gridy = 3; jLabel3 = new JLabel(); jLabel3.setText("New Password Again"); GridBagConstraints gridBagConstraints2 = new GridBagConstraints(); gridBagConstraints2.gridx = 0; gridBagConstraints2.anchor = GridBagConstraints.EAST; gridBagConstraints2.gridy = 2; jLabel2 = new JLabel(); jLabel2.setText("New Password"); GridBagConstraints gridBagConstraints11 = new GridBagConstraints(); gridBagConstraints11.gridx = 0; gridBagConstraints11.anchor = GridBagConstraints.EAST; gridBagConstraints11.gridy = 1; jLabel1 = new JLabel(); jLabel1.setText("Old Password"); GridBagConstraints gridBagConstraints1 = new GridBagConstraints(); gridBagConstraints1.fill = GridBagConstraints.BOTH; gridBagConstraints1.gridy = 0; gridBagConstraints1.weightx = 1.0; gridBagConstraints1.anchor = GridBagConstraints.WEST; gridBagConstraints1.gridx = 1; GridBagConstraints gridBagConstraints = new GridBagConstraints(); gridBagConstraints.gridx = 0; gridBagConstraints.anchor = GridBagConstraints.EAST; gridBagConstraints.gridy = 0; jLabel = new JLabel(); jLabel.setText("Change Password For:"); jContentPane = new JPanel(); jContentPane.setLayout(new GridBagLayout()); jContentPane.add(jLabel, gridBagConstraints); jContentPane.add(getJTextField(), gridBagConstraints1); jContentPane.add(jLabel1, gridBagConstraints11); jContentPane.add(jLabel2, gridBagConstraints2); jContentPane.add(jLabel3, gridBagConstraints3); jContentPane.add(getJButton(), gridBagConstraints4); jContentPane.add(getJButton1(), gridBagConstraints5); jContentPane.add(getJPasswordFieldOld(), gridBagConstraints6); jContentPane.add(getJPasswordField1(), gridBagConstraints7); jContentPane.add(getJPasswordField2(), gridBagConstraints8); jContentPane.add(jLabelResponse, gridBagConstraints9); jContentPane.add(getJPanel(), gridBagConstraints10); } return jContentPane; }
From source file:net.chaosserver.timelord.swingui.TaskDayPanel.java
/** * Builds the panel. This uses a GridBag to try and make formatting * grid-like between the unconnected rows. *//* ww w.j a v a 2s . c o m*/ protected void buildPanel() { GridBagLayout gridBagLayout = new GridBagLayout(); GridBagConstraints gridBagConstraints = new GridBagConstraints(); Insets defaultInsets = gridBagConstraints.insets; setLayout(gridBagLayout); taskName = new JLabel(); if (timelordTask.isHidden()) { Font taskFont = taskName.getFont(); Font italicFont = new Font(taskFont.getName(), Font.ITALIC, taskFont.getSize()); taskName.setFont(italicFont); } updateTaskNameLabel(); gridBagConstraints.anchor = GridBagConstraints.WEST; gridBagConstraints.weightx = LayoutConstants.HEAVY_WEIGHT; gridBagConstraints.insets = new Insets(0, LayoutConstants.SMALL_INSET, 0, LayoutConstants.BIG_INSET); gridBagConstraints.fill = GridBagConstraints.HORIZONTAL; gridBagLayout.addLayoutComponent(taskName, gridBagConstraints); add(taskName); minusButton = new JButton("-" + DateUtil.getSmallestTimeInMinutes() + "m"); minusButton.setToolTipText("Remove 15 minutes (0.25 hours) " + "of time from this task."); minusButton.setActionCommand(ACTION_MINUS_15); minusButton.addActionListener(this); gridBagConstraints.anchor = GridBagConstraints.CENTER; gridBagConstraints.insets = defaultInsets; gridBagConstraints.fill = GridBagConstraints.NONE; gridBagConstraints.weightx = 0; gridBagLayout.addLayoutComponent(minusButton, gridBagConstraints); add(minusButton); addButton = new JButton("+" + DateUtil.getSmallestTimeInMinutes() + "m"); addButton.setToolTipText("Add 15 minutes (0.25 hours) of " + "time from this task."); addButton.setActionCommand(ACTION_ADD_15); addButton.addActionListener(this); gridBagConstraints.anchor = GridBagConstraints.CENTER; gridBagConstraints.insets = defaultInsets; gridBagConstraints.fill = GridBagConstraints.NONE; gridBagConstraints.weightx = 0; gridBagLayout.addLayoutComponent(addButton, gridBagConstraints); add(addButton); timeLabel = new JLabel(); if (todayTaskDay != null) { timeLabel.setText(DateUtil.formatHours(null, todayTaskDay.getHours())); } else { timeLabel.setText(DateUtil.formatHours(null, 0)); } gridBagConstraints.anchor = GridBagConstraints.EAST; gridBagConstraints.fill = GridBagConstraints.NONE; gridBagConstraints.weightx = 0; gridBagConstraints.insets = new Insets(0, LayoutConstants.BIG_INSET, 0, LayoutConstants.SMALL_INSET); gridBagLayout.addLayoutComponent(timeLabel, gridBagConstraints); add(timeLabel); enabledButtons(); }
From source file:EditorPaneExample20.java
public EditorPaneExample20() { super("JEditorPane Example 20"); pane = new JEditorPane(); pane.setEditable(true); // Editable getContentPane().add(new JScrollPane(pane), "Center"); // Add a menu bar menuBar = new JMenuBar(); setJMenuBar(menuBar);/*from w ww . j a va 2s.c om*/ // Populate it createMenuBar(); // Build the panel of controls JPanel panel = new JPanel(); panel.setLayout(new GridBagLayout()); GridBagConstraints c = new GridBagConstraints(); c.gridwidth = 1; c.gridheight = 1; c.anchor = GridBagConstraints.EAST; c.fill = GridBagConstraints.NONE; c.weightx = 0.0; c.weighty = 0.0; JLabel urlLabel = new JLabel("URL: ", JLabel.RIGHT); panel.add(urlLabel, c); JLabel loadingLabel = new JLabel("State: ", JLabel.RIGHT); c.gridy = 1; panel.add(loadingLabel, c); JLabel typeLabel = new JLabel("Type: ", JLabel.RIGHT); c.gridy = 2; panel.add(typeLabel, c); c.gridy = 3; panel.add(new JLabel(LOAD_TIME), c); c.gridy = 4; c.gridwidth = 2; c.weightx = 1.0; c.anchor = GridBagConstraints.WEST; onlineLoad = new JCheckBox("Online Load"); panel.add(onlineLoad, c); onlineLoad.setSelected(true); onlineLoad.setForeground(typeLabel.getForeground()); c.gridy = 5; c.gridwidth = 2; c.weightx = 1.0; c.anchor = GridBagConstraints.WEST; editableBox = new JCheckBox("Editable JEditorPane"); panel.add(editableBox, c); editableBox.setSelected(true); editableBox.setForeground(typeLabel.getForeground()); c.gridy = 6; c.weightx = 0.0; JButton saveButton = new JButton("Save"); panel.add(saveButton, c); saveButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent evt) { EditorKit kit = pane.getEditorKit(); try { if (kit instanceof RTFEditorKit) { kit.write(System.out, pane.getDocument(), 0, pane.getDocument().getLength()); System.out.flush(); } else { if (writer == null) { writer = new OutputStreamWriter(System.out); pane.write(writer); writer.flush(); } kit.write(writer, pane.getDocument(), 0, pane.getDocument().getLength()); writer.flush(); } } catch (Exception e) { System.out.println("Write failed"); } } }); c.gridx = 1; insertButton = new JButton("Insert HTML"); panel.add(insertButton, c); insertButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent evt) { if (insertFrame == null) { insertFrame = new HTMLInsertFrame("HTML Insertion", pane); Point pt = EditorPaneExample20.this.getLocationOnScreen(); Dimension d = EditorPaneExample20.this.getSize(); insertFrame.setLocation(pt.x + d.width, pt.y); insertFrame.addWindowListener(new WindowAdapter() { public void windowClosing(WindowEvent evt) { insertFrame.dispose(); insertFrame = null; setInsertButtonState(); } }); insertButton.setEnabled(false); insertFrame.setVisible(true); } } }); insertButton.setEnabled(false); c.gridx = 1; c.gridy = 0; c.weightx = 1.0; c.anchor = GridBagConstraints.EAST; c.fill = GridBagConstraints.HORIZONTAL; urlCombo = new JComboBox(); panel.add(urlCombo, c); urlCombo.setEditable(true); loadingState = new JLabel(spaces, JLabel.LEFT); loadingState.setForeground(Color.black); c.gridy = 1; panel.add(loadingState, c); loadedType = new JLabel(spaces, JLabel.LEFT); loadedType.setForeground(Color.black); c.gridy = 2; panel.add(loadedType, c); timeLabel = new JLabel(""); c.gridy = 3; panel.add(timeLabel, c); getContentPane().add(panel, "South"); // Register a custom EditorKit for HTML ClassLoader loader = getClass().getClassLoader(); if (loader != null) { // Java 2 JEditorPane.registerEditorKitForContentType("text/html", "AdvancedSwing.Chapter4.EnhancedHTMLEditorKit", loader); } else { // JDK 1.1 JEditorPane.registerEditorKitForContentType("text/html", "AdvancedSwing.Chapter4.EnhancedHTMLEditorKit"); } // Allocate the empty tree model DefaultMutableTreeNode emptyRootNode = new DefaultMutableTreeNode("Empty"); emptyModel = new DefaultTreeModel(emptyRootNode); // Create and place the heading tree tree = new JTree(emptyModel); tree.setPreferredSize(new Dimension(200, 200)); getContentPane().add(new JScrollPane(tree), "East"); // Change page based on combo selection urlCombo.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent evt) { if (populatingCombo == true) { return; } Object selection = urlCombo.getSelectedItem(); loadNewPage(selection); } }); // Change editability based on the checkbox editableBox.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent evt) { pane.setEditable(editableBox.isSelected()); pane.revalidate(); pane.repaint(); } }); // Listen for page load to complete pane.addPropertyChangeListener(new PropertyChangeListener() { public void propertyChange(PropertyChangeEvent evt) { if (evt.getPropertyName().equals("page")) { loadComplete(); displayLoadTime(); populateCombo(findLinks(pane.getDocument(), null)); TreeNode node = buildHeadingTree(pane.getDocument()); tree.setModel(new DefaultTreeModel(node)); createMenuBar(); enableMenuBar(true); getRootPane().revalidate(); enableInput(); loadingPage = false; } } }); // Listener for tree selection tree.addTreeSelectionListener(new TreeSelectionListener() { public void valueChanged(TreeSelectionEvent evt) { TreePath path = evt.getNewLeadSelectionPath(); if (path != null) { DefaultMutableTreeNode node = (DefaultMutableTreeNode) path.getLastPathComponent(); Object userObject = node.getUserObject(); if (userObject instanceof Heading) { Heading heading = (Heading) userObject; try { Rectangle textRect = pane.modelToView(heading.getOffset()); textRect.y += 3 * textRect.height; pane.scrollRectToVisible(textRect); } catch (BadLocationException e) { } } } } }); // Listener for hypertext events pane.addHyperlinkListener(new HyperlinkListener() { public void hyperlinkUpdate(HyperlinkEvent evt) { // Ignore hyperlink events if the frame is busy if (loadingPage == true) { return; } if (evt.getEventType() == HyperlinkEvent.EventType.ACTIVATED) { JEditorPane sp = (JEditorPane) evt.getSource(); if (evt instanceof HTMLFrameHyperlinkEvent) { HTMLDocument doc = (HTMLDocument) sp.getDocument(); doc.processHTMLFrameHyperlinkEvent((HTMLFrameHyperlinkEvent) evt); } else { loadNewPage(evt.getURL()); } } else if (evt.getEventType() == HyperlinkEvent.EventType.ENTERED) { pane.setCursor(handCursor); } else if (evt.getEventType() == HyperlinkEvent.EventType.EXITED) { pane.setCursor(defaultCursor); } } }); }
From source file:savant.plugin.ToolSettingsPanel.java
private void addArgumentToPanel(ToolArgument arg, int row) { GridBagConstraints gbc = new GridBagConstraints(); gbc.insets = new Insets(5, 5, 5, 5); gbc.gridy = row;/*from w ww . java 2 s .c o m*/ JComponent widget = null; if (arg.type == ToolArgument.Type.BOOL) { gbc.gridx = 2; gbc.anchor = GridBagConstraints.WEST; addWidget(arg, new BoolCheck(arg), gbc); } else { gbc.gridx = 1; gbc.anchor = GridBagConstraints.EAST; JLabel nameLabel = new JLabel(arg.name + ":"); add(nameLabel, gbc); gbc.gridx = 2; gbc.anchor = GridBagConstraints.WEST; gbc.gridwidth = GridBagConstraints.REMAINDER; gbc.weightx = 1.0; JTextField field = null; switch (arg.type) { case INT: field = new JFormattedTextField(); ((JFormattedTextField) field).setValue(Integer.valueOf(arg.value != null ? arg.value : "0")); field.setColumns(5); addField(arg, field, gbc); break; case FLOAT: field = new JFormattedTextField(); ((JFormattedTextField) field).setValue(Double.valueOf(arg.value != null ? arg.value : "0.0")); field.setColumns(10); addField(arg, field, gbc); break; case OUTPUT_FILE: gbc.gridwidth = 1; gbc.fill = GridBagConstraints.HORIZONTAL; field = new JTextField(arg.value); addField(arg, field, gbc); gbc.gridx = 3; gbc.gridwidth = GridBagConstraints.REMAINDER; gbc.weightx = 0.0; JCheckBox loadCheck = new JCheckBox("Load upon Completion", true); loadCheck.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent ae) { tool.loadUponCompletion = ((JCheckBox) ae.getSource()).isSelected(); } }); add(loadCheck, gbc); break; case RANGE: field = new JTextField(); field.setColumns(25); LocationController.getInstance().addListener(new RangeUpdater(field)); addField(arg, field, gbc); break; case LIST: addWidget(arg, new StringCombo(arg), gbc); break; case MULTI: gbc.fill = GridBagConstraints.HORIZONTAL; addWidget(arg, new MultiCheckGrid(arg), gbc); break; case BAM_INPUT_FILE: TrackUtils.addTrackListener( (TrackCombo) addWidget(arg, new TrackCombo(arg, DataFormat.ALIGNMENT), gbc)); break; case FASTA_INPUT_FILE: TrackUtils.addTrackListener( (TrackCombo) addWidget(arg, new TrackCombo(arg, DataFormat.SEQUENCE), gbc)); break; } } }
From source file:verdandi.ui.settings.DefaultSettingsPanel.java
private JPanel getPersistenceSettingsPanel() { JPanel res = new JPanel(new GridBagLayout()); res.setBorder(BorderFactory.createTitledBorder(RC.getString("settingseditor.persistence.title"))); GridBagConstraints c = new GridBagConstraints(); c.insets = new Insets(5, 5, 5, 5); c.gridy = 0;//from w w w .j ava2s.co m c.weighty = 0.0; c.anchor = GridBagConstraints.WEST; PersistenceConfigurationDescription pdc = conf.getPersistenceConfigurationDescription(); if (pdc == null) { return res; } for (String key : pdc.getOrderedKeys()) { c.weightx = 0.1; c.gridx = 0; c.fill = GridBagConstraints.NONE; JLabel lbl = new JLabel(pdc.get(key).getName()); lbl.setToolTipText(pdc.get(key).getDescription()); res.add(lbl, c); c.gridx = 1; c.weightx = 1.0; c.fill = GridBagConstraints.HORIZONTAL; JTextField txt = new JTextField(20); txt.setText(conf.getString(pdc.get(key).getConfigKey())); res.add(txt, c); persistenceFields.put(pdc.get(key).getConfigKey(), txt); c.gridy++; } return res; }
From source file:org.jtrfp.trcl.gui.ConfigWindow.java
public ConfigWindow() { setTitle("Settings"); setSize(340, 540);/* w w w .jav a 2s . c om*/ if (config == null) config = new TRConfiguration(); JTabbedPane tabbedPane = new JTabbedPane(JTabbedPane.TOP); getContentPane().add(tabbedPane, BorderLayout.CENTER); JPanel generalTab = new JPanel(); tabbedPane.addTab("General", new ImageIcon(ConfigWindow.class .getResource("/org/freedesktop/tango/22x22/mimetypes/application-x-executable.png")), generalTab, null); GridBagLayout gbl_generalTab = new GridBagLayout(); gbl_generalTab.columnWidths = new int[] { 0, 0 }; gbl_generalTab.rowHeights = new int[] { 0, 188, 222, 0 }; gbl_generalTab.columnWeights = new double[] { 1.0, Double.MIN_VALUE }; gbl_generalTab.rowWeights = new double[] { 0.0, 1.0, 0.0, Double.MIN_VALUE }; generalTab.setLayout(gbl_generalTab); JPanel settingsLoadSavePanel = new JPanel(); GridBagConstraints gbc_settingsLoadSavePanel = new GridBagConstraints(); gbc_settingsLoadSavePanel.insets = new Insets(0, 0, 5, 0); gbc_settingsLoadSavePanel.anchor = GridBagConstraints.WEST; gbc_settingsLoadSavePanel.gridx = 0; gbc_settingsLoadSavePanel.gridy = 0; generalTab.add(settingsLoadSavePanel, gbc_settingsLoadSavePanel); settingsLoadSavePanel.setBorder(new TitledBorder(new EtchedBorder(EtchedBorder.LOWERED, null, null), "Overall Settings", TitledBorder.LEADING, TitledBorder.TOP, null, null)); FlowLayout flowLayout_1 = (FlowLayout) settingsLoadSavePanel.getLayout(); flowLayout_1.setAlignment(FlowLayout.LEFT); JButton btnSave = new JButton("Export..."); btnSave.setToolTipText("Export these settings to an external file"); settingsLoadSavePanel.add(btnSave); btnSave.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent arg0) { exportSettings(); } }); JButton btnLoad = new JButton("Import..."); btnLoad.setToolTipText("Import an external settings file"); settingsLoadSavePanel.add(btnLoad); btnLoad.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent arg0) { importSettings(); } }); JButton btnConfigReset = new JButton("Reset"); btnConfigReset.setToolTipText("Reset all settings to defaults"); settingsLoadSavePanel.add(btnConfigReset); btnConfigReset.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent arg0) { defaultSettings(); } }); JPanel registeredPODsPanel = new JPanel(); registeredPODsPanel.setBorder(new TitledBorder(new EtchedBorder(EtchedBorder.LOWERED, null, null), "Registered PODs", TitledBorder.LEFT, TitledBorder.TOP, null, null)); GridBagConstraints gbc_registeredPODsPanel = new GridBagConstraints(); gbc_registeredPODsPanel.insets = new Insets(0, 0, 5, 0); gbc_registeredPODsPanel.fill = GridBagConstraints.BOTH; gbc_registeredPODsPanel.gridx = 0; gbc_registeredPODsPanel.gridy = 1; generalTab.add(registeredPODsPanel, gbc_registeredPODsPanel); GridBagLayout gbl_registeredPODsPanel = new GridBagLayout(); gbl_registeredPODsPanel.columnWidths = new int[] { 272, 0 }; gbl_registeredPODsPanel.rowHeights = new int[] { 76, 0, 0 }; gbl_registeredPODsPanel.columnWeights = new double[] { 1.0, Double.MIN_VALUE }; gbl_registeredPODsPanel.rowWeights = new double[] { 1.0, 1.0, Double.MIN_VALUE }; registeredPODsPanel.setLayout(gbl_registeredPODsPanel); JPanel podListPanel = new JPanel(); GridBagConstraints gbc_podListPanel = new GridBagConstraints(); gbc_podListPanel.insets = new Insets(0, 0, 5, 0); gbc_podListPanel.fill = GridBagConstraints.BOTH; gbc_podListPanel.gridx = 0; gbc_podListPanel.gridy = 0; registeredPODsPanel.add(podListPanel, gbc_podListPanel); podListPanel.setLayout(new BorderLayout(0, 0)); JScrollPane podListScrollPane = new JScrollPane(); podListPanel.add(podListScrollPane, BorderLayout.CENTER); podList = new JList(podLM); podList.setSelectionMode(ListSelectionModel.SINGLE_SELECTION); podListScrollPane.setViewportView(podList); JPanel podListOpButtonPanel = new JPanel(); podListOpButtonPanel.setBorder(null); GridBagConstraints gbc_podListOpButtonPanel = new GridBagConstraints(); gbc_podListOpButtonPanel.anchor = GridBagConstraints.NORTH; gbc_podListOpButtonPanel.gridx = 0; gbc_podListOpButtonPanel.gridy = 1; registeredPODsPanel.add(podListOpButtonPanel, gbc_podListOpButtonPanel); FlowLayout flowLayout = (FlowLayout) podListOpButtonPanel.getLayout(); flowLayout.setAlignment(FlowLayout.LEFT); JButton addPodButton = new JButton("Add..."); addPodButton.setIcon( new ImageIcon(ConfigWindow.class.getResource("/org/freedesktop/tango/16x16/actions/list-add.png"))); addPodButton.setToolTipText("Add a POD to the registry to be considered when running a game."); podListOpButtonPanel.add(addPodButton); addPodButton.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent arg0) { addPOD(); } }); JButton removePodButton = new JButton("Remove"); removePodButton.setIcon(new ImageIcon( ConfigWindow.class.getResource("/org/freedesktop/tango/16x16/actions/list-remove.png"))); removePodButton.setToolTipText("Remove a POD file from being considered when playing a game"); podListOpButtonPanel.add(removePodButton); removePodButton.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent arg0) { podLM.removeElement(podList.getSelectedValue()); } }); JButton podEditButton = new JButton("Edit..."); podEditButton.setIcon(null); podEditButton.setToolTipText("Edit the selected POD path"); podListOpButtonPanel.add(podEditButton); podEditButton.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent arg0) { editPODPath(); } }); JPanel missionPanel = new JPanel(); GridBagConstraints gbc_missionPanel = new GridBagConstraints(); gbc_missionPanel.fill = GridBagConstraints.BOTH; gbc_missionPanel.gridx = 0; gbc_missionPanel.gridy = 2; generalTab.add(missionPanel, gbc_missionPanel); missionPanel.setBorder(new TitledBorder(new EtchedBorder(EtchedBorder.LOWERED, null, null), "Missions", TitledBorder.LEADING, TitledBorder.TOP, null, null)); GridBagLayout gbl_missionPanel = new GridBagLayout(); gbl_missionPanel.columnWidths = new int[] { 0, 0 }; gbl_missionPanel.rowHeights = new int[] { 0, 0, 0 }; gbl_missionPanel.columnWeights = new double[] { 1.0, Double.MIN_VALUE }; gbl_missionPanel.rowWeights = new double[] { 1.0, 0.0, Double.MIN_VALUE }; missionPanel.setLayout(gbl_missionPanel); JScrollPane scrollPane = new JScrollPane(); GridBagConstraints gbc_scrollPane = new GridBagConstraints(); gbc_scrollPane.insets = new Insets(0, 0, 5, 0); gbc_scrollPane.fill = GridBagConstraints.BOTH; gbc_scrollPane.gridx = 0; gbc_scrollPane.gridy = 0; missionPanel.add(scrollPane, gbc_scrollPane); missionList = new JList(missionLM); missionList.setSelectionMode(ListSelectionModel.SINGLE_SELECTION); scrollPane.setViewportView(missionList); JPanel missionListOpButtonPanel = new JPanel(); GridBagConstraints gbc_missionListOpButtonPanel = new GridBagConstraints(); gbc_missionListOpButtonPanel.anchor = GridBagConstraints.NORTH; gbc_missionListOpButtonPanel.gridx = 0; gbc_missionListOpButtonPanel.gridy = 1; missionPanel.add(missionListOpButtonPanel, gbc_missionListOpButtonPanel); JButton addVOXButton = new JButton("Add..."); addVOXButton.setIcon( new ImageIcon(ConfigWindow.class.getResource("/org/freedesktop/tango/16x16/actions/list-add.png"))); addVOXButton.setToolTipText("Add an external VOX file as a mission"); missionListOpButtonPanel.add(addVOXButton); addVOXButton.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent arg0) { addVOX(); } }); final JButton removeVOXButton = new JButton("Remove"); removeVOXButton.setIcon(new ImageIcon( ConfigWindow.class.getResource("/org/freedesktop/tango/16x16/actions/list-remove.png"))); removeVOXButton.setToolTipText("Remove the selected mission"); missionListOpButtonPanel.add(removeVOXButton); removeVOXButton.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent arg0) { missionLM.remove(missionList.getSelectedIndex()); } }); final JButton editVOXButton = new JButton("Edit..."); editVOXButton.setToolTipText("Edit the selected Mission's VOX path"); missionListOpButtonPanel.add(editVOXButton); editVOXButton.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent arg0) { editVOXPath(); } }); missionList.addListSelectionListener(new ListSelectionListener() { @Override public void valueChanged(ListSelectionEvent evt) { final String val = (String) missionList.getSelectedValue(); if (val == null) missionList.setSelectedIndex(0); else if (isBuiltinVOX(val)) { removeVOXButton.setEnabled(false); editVOXButton.setEnabled(false); } else { removeVOXButton.setEnabled(true); editVOXButton.setEnabled(true); } } }); JPanel soundTab = new JPanel(); tabbedPane.addTab("Sound", new ImageIcon( ConfigWindow.class.getResource("/org/freedesktop/tango/22x22/devices/audio-card.png")), soundTab, null); GridBagLayout gbl_soundTab = new GridBagLayout(); gbl_soundTab.columnWidths = new int[] { 0, 0 }; gbl_soundTab.rowHeights = new int[] { 65, 51, 70, 132, 0, 0, 0 }; gbl_soundTab.columnWeights = new double[] { 1.0, Double.MIN_VALUE }; gbl_soundTab.rowWeights = new double[] { 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, Double.MIN_VALUE }; soundTab.setLayout(gbl_soundTab); JPanel checkboxPanel = new JPanel(); GridBagConstraints gbc_checkboxPanel = new GridBagConstraints(); gbc_checkboxPanel.insets = new Insets(0, 0, 5, 0); gbc_checkboxPanel.fill = GridBagConstraints.BOTH; gbc_checkboxPanel.gridx = 0; gbc_checkboxPanel.gridy = 0; soundTab.add(checkboxPanel, gbc_checkboxPanel); chckbxLinearInterpolation = new JCheckBox("Linear Filtering"); chckbxLinearInterpolation.setToolTipText("Use the GPU's TMU to smooth playback of low-rate samples."); chckbxLinearInterpolation.setHorizontalAlignment(SwingConstants.LEFT); checkboxPanel.add(chckbxLinearInterpolation); chckbxLinearInterpolation.addItemListener(new ItemListener() { @Override public void itemStateChanged(ItemEvent e) { needRestart = true; } }); chckbxBufferLag = new JCheckBox("Buffer Lag"); chckbxBufferLag.setToolTipText("Improves efficiency, doubles latency."); checkboxPanel.add(chckbxBufferLag); JPanel modStereoWidthPanel = new JPanel(); FlowLayout flowLayout_2 = (FlowLayout) modStereoWidthPanel.getLayout(); flowLayout_2.setAlignment(FlowLayout.LEFT); modStereoWidthPanel.setBorder(new TitledBorder(new EtchedBorder(EtchedBorder.LOWERED, null, null), "MOD Stereo Width", TitledBorder.LEADING, TitledBorder.TOP, null, null)); GridBagConstraints gbc_modStereoWidthPanel = new GridBagConstraints(); gbc_modStereoWidthPanel.anchor = GridBagConstraints.NORTH; gbc_modStereoWidthPanel.insets = new Insets(0, 0, 5, 0); gbc_modStereoWidthPanel.fill = GridBagConstraints.HORIZONTAL; gbc_modStereoWidthPanel.gridx = 0; gbc_modStereoWidthPanel.gridy = 1; soundTab.add(modStereoWidthPanel, gbc_modStereoWidthPanel); modStereoWidthSlider = new JSlider(); modStereoWidthSlider.setPaintTicks(true); modStereoWidthSlider.setMinorTickSpacing(25); modStereoWidthPanel.add(modStereoWidthSlider); final JLabel modStereoWidthLbl = new JLabel("NN%"); modStereoWidthPanel.add(modStereoWidthLbl); JPanel bufferSizePanel = new JPanel(); FlowLayout flowLayout_3 = (FlowLayout) bufferSizePanel.getLayout(); flowLayout_3.setAlignment(FlowLayout.LEFT); bufferSizePanel.setBorder( new TitledBorder(null, "Buffer Size", TitledBorder.LEADING, TitledBorder.TOP, null, null)); GridBagConstraints gbc_bufferSizePanel = new GridBagConstraints(); gbc_bufferSizePanel.anchor = GridBagConstraints.NORTH; gbc_bufferSizePanel.insets = new Insets(0, 0, 5, 0); gbc_bufferSizePanel.fill = GridBagConstraints.HORIZONTAL; gbc_bufferSizePanel.gridx = 0; gbc_bufferSizePanel.gridy = 2; soundTab.add(bufferSizePanel, gbc_bufferSizePanel); audioBufferSizeCB = new JComboBox(); audioBufferSizeCB.setModel(new DefaultComboBoxModel(AudioBufferSize.values())); bufferSizePanel.add(audioBufferSizeCB); soundOutputSelectorGUI = new SoundOutputSelectorGUI(); soundOutputSelectorGUI.setBorder( new TitledBorder(null, "Output Driver", TitledBorder.LEADING, TitledBorder.TOP, null, null)); GridBagConstraints gbc_soundOutputSelectorGUI = new GridBagConstraints(); gbc_soundOutputSelectorGUI.anchor = GridBagConstraints.NORTH; gbc_soundOutputSelectorGUI.insets = new Insets(0, 0, 5, 0); gbc_soundOutputSelectorGUI.fill = GridBagConstraints.HORIZONTAL; gbc_soundOutputSelectorGUI.gridx = 0; gbc_soundOutputSelectorGUI.gridy = 3; soundTab.add(soundOutputSelectorGUI, gbc_soundOutputSelectorGUI); modStereoWidthSlider.addChangeListener(new ChangeListener() { @Override public void stateChanged(ChangeEvent arg0) { modStereoWidthLbl.setText(modStereoWidthSlider.getValue() + "%"); needRestart = true; } }); JPanel okCancelPanel = new JPanel(); getContentPane().add(okCancelPanel, BorderLayout.SOUTH); okCancelPanel.setLayout(new BorderLayout(0, 0)); JButton btnOk = new JButton("OK"); btnOk.setToolTipText("Apply these settings and close the window"); okCancelPanel.add(btnOk, BorderLayout.WEST); btnOk.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent arg0) { applySettings(); ConfigWindow.this.setVisible(false); } }); JButton btnCancel = new JButton("Cancel"); btnCancel.setToolTipText("Close the window without applying settings"); okCancelPanel.add(btnCancel, BorderLayout.EAST); JLabel lblConfigpath = new JLabel(TRConfiguration.getConfigFilePath().getAbsolutePath()); lblConfigpath.setIcon(null); lblConfigpath.setToolTipText("Default config file path"); lblConfigpath.setHorizontalAlignment(SwingConstants.CENTER); lblConfigpath.setFont(new Font("Dialog", Font.BOLD, 6)); okCancelPanel.add(lblConfigpath, BorderLayout.CENTER); btnCancel.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent arg0) { ConfigWindow.this.setVisible(false); } }); }
From source file:edu.harvard.mcz.imagecapture.ImageZoomPanel.java
/** * This method initializes jPanel /*from ww w . j a v a 2s . c o m*/ * * @return javax.swing.JPanel */ private JPanel getJPanel() { if (jPanel == null) { GridBagConstraints gridBagConstraints12 = new GridBagConstraints(); gridBagConstraints12.gridx = 4; gridBagConstraints12.gridy = 0; GridBagConstraints gridBagConstraints2 = new GridBagConstraints(); gridBagConstraints2.anchor = GridBagConstraints.WEST; GridBagConstraints gridBagConstraints11 = new GridBagConstraints(); gridBagConstraints11.gridx = 3; gridBagConstraints11.gridy = 0; GridBagConstraints gridBagConstraints1 = new GridBagConstraints(); gridBagConstraints1.gridx = 2; gridBagConstraints1.gridy = 0; GridBagConstraints gridBagConstraints = new GridBagConstraints(); gridBagConstraints.gridx = 1; gridBagConstraints.anchor = GridBagConstraints.WEST; gridBagConstraints.gridy = 0; jPanel = new JPanel(); jPanel.setLayout(new GridBagLayout()); jPanel.add(getJButton(), gridBagConstraints2); jPanel.add(getJButton1(), gridBagConstraints); jPanel.add(getJButton2(), gridBagConstraints1); jPanel.add(getJButton3(), gridBagConstraints11); jPanel.add(getJButton4(), gridBagConstraints12); } return jPanel; }
From source file:edu.harvard.mcz.imagecapture.LoginDialog.java
/** * This method initializes jPanel /*from w ww .j a v a 2 s.c o m*/ * * @return javax.swing.JPanel */ private JPanel getJPanel() { if (jPanel == null) { GridBagConstraints gridBagConstraints17 = new GridBagConstraints(); gridBagConstraints17.gridx = 1; gridBagConstraints17.anchor = GridBagConstraints.WEST; gridBagConstraints17.fill = GridBagConstraints.HORIZONTAL; gridBagConstraints17.gridy = 16; jLabel6 = new JLabel(); jLabel6.setText(""); GridBagConstraints gridBagConstraints62 = new GridBagConstraints(); gridBagConstraints62.gridx = 0; gridBagConstraints62.gridwidth = 2; gridBagConstraints62.fill = GridBagConstraints.HORIZONTAL; gridBagConstraints62.anchor = GridBagConstraints.WEST; gridBagConstraints62.gridy = 6; GridBagConstraints gridBagConstraints51 = new GridBagConstraints(); gridBagConstraints51.gridx = 0; gridBagConstraints51.gridy = 4; GridBagConstraints gridBagConstraints41 = new GridBagConstraints(); gridBagConstraints41.fill = GridBagConstraints.BOTH; gridBagConstraints41.gridy = 3; gridBagConstraints41.weightx = 1.0; gridBagConstraints41.anchor = GridBagConstraints.WEST; gridBagConstraints41.gridx = 1; GridBagConstraints gridBagConstraints31 = new GridBagConstraints(); gridBagConstraints31.gridx = 0; gridBagConstraints31.anchor = GridBagConstraints.EAST; gridBagConstraints31.gridy = 3; jLabel9 = new JLabel(); jLabel9.setText("Password"); GridBagConstraints gridBagConstraints21 = new GridBagConstraints(); gridBagConstraints21.gridx = 0; gridBagConstraints21.anchor = GridBagConstraints.EAST; gridBagConstraints21.gridy = 2; jLabel8 = new JLabel(); jLabel8.setText("email"); GridBagConstraints gridBagConstraints16 = new GridBagConstraints(); gridBagConstraints16.fill = GridBagConstraints.BOTH; gridBagConstraints16.gridy = 2; gridBagConstraints16.weightx = 1.0; gridBagConstraints16.anchor = GridBagConstraints.WEST; gridBagConstraints16.gridx = 1; GridBagConstraints gridBagConstraints15 = new GridBagConstraints(); gridBagConstraints15.gridx = 1; gridBagConstraints15.gridy = 12; GridBagConstraints gridBagConstraints61 = new GridBagConstraints(); gridBagConstraints61.gridx = 0; gridBagConstraints61.gridwidth = 1; gridBagConstraints61.anchor = GridBagConstraints.NORTHEAST; gridBagConstraints61.gridheight = 4; gridBagConstraints61.fill = GridBagConstraints.NONE; gridBagConstraints61.weighty = 1.0; gridBagConstraints61.insets = new Insets(0, 0, 0, 0); gridBagConstraints61.gridy = 10; jLabel7 = new JLabel(); URL iconFile = this.getClass().getResource("/edu/harvard/mcz/imagecapture/resources/key_small.png"); try { //this.setIconImage(new ImageIcon(iconFile).getImage()); jLabel7.setIcon(new ImageIcon(iconFile)); } catch (Exception e) { System.out.println("Can't open icon file: " + iconFile); } jLabel7.setText(" "); GridBagConstraints gridBagConstraints12 = new GridBagConstraints(); gridBagConstraints12.gridx = 1; gridBagConstraints12.anchor = GridBagConstraints.NORTH; gridBagConstraints12.fill = GridBagConstraints.NONE; gridBagConstraints12.gridy = 1; jLabel5 = new JLabel(); jLabel5.setText("Connect to Database"); jLabel4 = new JLabel(); jLabel4.setText("Dialect"); jLabel3 = new JLabel(); jLabel3.setText("Connection"); jLabel2 = new JLabel(); jLabel2.setText("Driver"); GridBagConstraints gridBagConstraints2 = new GridBagConstraints(); gridBagConstraints2.gridx = 0; gridBagConstraints2.gridy = 2; jLabel1 = new JLabel(); jLabel1.setText("DBPassword"); jLabel = new JLabel(); jLabel.setText("Schema"); jPanel = new JPanel(); jPanel.setLayout(new GridBagLayout()); jPanel.add(jLabel5, gridBagConstraints12); jPanel.add(jLabel7, gridBagConstraints61); jPanel.add(getJPanel1(), gridBagConstraints15); jPanel.add(getJTextFieldEmail(), gridBagConstraints16); jPanel.add(jLabel8, gridBagConstraints21); jPanel.add(jLabel9, gridBagConstraints31); jPanel.add(getJPasswordFieldUser(), gridBagConstraints41); jPanel.add(getJButton2(), gridBagConstraints51); jPanel.add(getJPanelAdvanced(), gridBagConstraints62); jPanel.add(jLabel6, gridBagConstraints17); } return jPanel; }
From source file:us.paulevans.basicxslt.SaveAsConfigurationFrame.java
/** * Builds the main panel/* ww w. j a va2 s . co m*/ * @return */ private JPanel buildMainPanel() { int row; GridBagLayout layout; GridBagConstraints constraints; JPanel main; JLabel label; layout = new GridBagLayout(); constraints = new GridBagConstraints(); main = new JPanel(layout); row = 0; GUIUtils.add(main, new JLabel(stringFactory.getString(LabelStringFactory.SAVEASCONFIG_FRAME_CURRENT_CONFIGURATION)), layout, constraints, row, 0, 1, 1, GridBagConstraints.EAST, GridBagConstraints.NONE, GUIUtils.MED_INSETS); GUIUtils.add(main, label = new JLabel(userPrefs.getConfiguration()), layout, constraints, row++, 1, 1, 1, GridBagConstraints.WEST, GridBagConstraints.NONE, GUIUtils.SMALL_INSETS); label.setForeground(Color.BLUE); GUIUtils.add(main, new JSeparator(), layout, constraints, row++, 0, 1, 2, 1, 1, GridBagConstraints.CENTER, GridBagConstraints.BOTH, GUIUtils.MED_INSETS); GUIUtils.add(main, new JLabel(stringFactory.getString(LabelStringFactory.SAVEASCONFIG_FRAME_CONFIGURATION_NAME)), layout, constraints, row, 0, 1, 1, GridBagConstraints.NORTHEAST, GridBagConstraints.NONE, GUIUtils.SMALL_INSETS); GUIUtils.add(main, new JScrollPane(configurationName = new JTextField(20)), layout, constraints, row++, 1, 1, 1, GridBagConstraints.WEST, GridBagConstraints.NONE, GUIUtils.SMALL_INSETS); GUIUtils.add(main, new JLabel(stringFactory.getString(LabelStringFactory.SAVEASCONFIG_FRAME_MAKE_DEFAULT)), layout, constraints, row, 0, 1, 1, GridBagConstraints.EAST, GridBagConstraints.NONE, GUIUtils.SMALL_INSETS); GUIUtils.add(main, makeDefault = new JCheckBox(), layout, constraints, row++, 1, 1, 1, GridBagConstraints.WEST, GridBagConstraints.NONE, GUIUtils.SMALL_INSETS); return main; }