List of usage examples for java.awt GridBagConstraints CENTER
int CENTER
To view the source code for java.awt GridBagConstraints CENTER.
Click Source Link
From source file:com.sec.ose.osi.ui.dialog.setting.JPanProxySetting.java
private void initialize() { GridBagConstraints gridBagConstraints9 = new GridBagConstraints(); gridBagConstraints9.gridx = 2;/*from w ww . jav a2s . com*/ gridBagConstraints9.fill = GridBagConstraints.HORIZONTAL; gridBagConstraints9.gridwidth = 2; gridBagConstraints9.insets = new Insets(10, 10, 0, 10); gridBagConstraints9.anchor = GridBagConstraints.NORTH; gridBagConstraints9.gridy = 0; GridBagConstraints gridBagConstraints7 = new GridBagConstraints(); gridBagConstraints7.gridx = 0; gridBagConstraints7.fill = GridBagConstraints.BOTH; gridBagConstraints7.gridwidth = 2; gridBagConstraints7.insets = new Insets(0, 0, 0, 0); gridBagConstraints7.weightx = 1.0; gridBagConstraints7.anchor = GridBagConstraints.CENTER; gridBagConstraints7.weighty = 1.0; gridBagConstraints7.gridy = 0; this.setLayout(new GridBagLayout()); this.add(getJPanelValue(), gridBagConstraints7); this.add(getJPanelButtons(), gridBagConstraints9); }
From source file:org.bench4Q.console.ui.section.LW_ConfigLoadShowSection.java
/** * @param resources// w ww .java 2s . co m * @param processControl * @param dispatcherFactory * @param configModel * @param configLoadSection * @throws ConsoleException */ public LW_ConfigLoadShowSection(Resources resources, ProcessControl processControl, SwingDispatcherFactory dispatcherFactory, ConfigModel configModel, LW_ConfigLoadSection configLoadSection) throws ConsoleException { m_resources = resources; m_processControl = processControl; m_swingDispatcherFactory = dispatcherFactory; m_configModel = configModel; m_args = m_configModel.getArgs(); this.setLayout(new GridBagLayout()); this.setPreferredSize(new Dimension(683, 475)); this.setMinimumSize(new Dimension(683, 475)); picPanel = new PicPanel(m_args); // JPanel picPanel = new JPanel(); this.add(picPanel, new GridBagConstraints(0, 0, 1, 1, 1.0, 1.0, GridBagConstraints.CENTER, GridBagConstraints.BOTH, new Insets(0, 0, 0, 0), 0, 0)); m_configModel.addListener(new ConfigModel.AbstractListener() { public void isArgsChanged() { resetConfig(); } }); configLoadSection.addListener(new LW_ConfigLoadSection.AbstractListener() { public void isArgsChanged() { resetConfig(); } }); }
From source file:SocketApplet.java
/** Initialize the GUI nicely. */ public void init() { Label aLabel;/*from w ww . jav a 2 s.c o m*/ setLayout(new GridBagLayout()); int LOGO_COL = 1; int LABEL_COL = 2; int TEXT_COL = 3; int BUTTON_COL = 1; GridBagConstraints gbc = new GridBagConstraints(); gbc.weightx = 100.0; gbc.weighty = 100.0; gbc.gridx = LABEL_COL; gbc.gridy = 0; gbc.anchor = GridBagConstraints.EAST; add(aLabel = new Label("Name:", Label.CENTER), gbc); gbc.anchor = GridBagConstraints.CENTER; gbc.gridx = TEXT_COL; gbc.gridy = 0; add(nameTF = new TextField(10), gbc); gbc.gridx = LABEL_COL; gbc.gridy = 1; gbc.anchor = GridBagConstraints.EAST; add(aLabel = new Label("Password:", Label.CENTER), gbc); gbc.anchor = GridBagConstraints.CENTER; gbc.gridx = TEXT_COL; gbc.gridy = 1; add(passTF = new TextField(10), gbc); passTF.setEchoChar('*'); gbc.gridx = LABEL_COL; gbc.gridy = 2; gbc.anchor = GridBagConstraints.EAST; add(aLabel = new Label("Domain:", Label.CENTER), gbc); gbc.anchor = GridBagConstraints.CENTER; gbc.gridx = TEXT_COL; gbc.gridy = 2; add(domainTF = new TextField(10), gbc); sendButton = new Button("Send data"); gbc.gridx = BUTTON_COL; gbc.gridy = 3; gbc.gridwidth = 3; add(sendButton, gbc); whence = getCodeBase(); // Now the action begins... sendButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent evt) { String name = nameTF.getText(); if (name.length() == 0) { showStatus("Name required"); return; } String domain = domainTF.getText(); if (domain.length() == 0) { showStatus("Domain required"); return; } showStatus("Connecting to host " + whence.getHost() + " as " + nameTF.getText()); try { Socket s = new Socket(getCodeBase().getHost(), 3333); PrintWriter pf = new PrintWriter(s.getOutputStream(), true); // send login name pf.println(nameTF.getText()); // passwd pf.println(passTF.getText()); // and domain pf.println(domainTF.getText()); BufferedReader is = new BufferedReader(new InputStreamReader(s.getInputStream())); String response = is.readLine(); showStatus(response); } catch (IOException e) { showStatus("ERROR: " + e.getMessage()); } } }); }
From source file:org.jets3t.gui.ProgressDialog.java
private void initGui() { // Initialise skins factory. skinsFactory = SkinsFactory.getInstance(applicationProperties); // Set Skinned Look and Feel. LookAndFeel lookAndFeel = skinsFactory.createSkinnedMetalTheme("SkinnedLookAndFeel"); try {/*from ww w . j a v a 2s . c o m*/ UIManager.setLookAndFeel(lookAndFeel); } catch (UnsupportedLookAndFeelException e) { log.error("Unable to set skinned LookAndFeel", e); } this.setDefaultCloseOperation(JDialog.DO_NOTHING_ON_CLOSE); this.setResizable(true); JPanel container = new JPanel(new GridBagLayout()); statusMessageLabel = skinsFactory.createSkinnedJHtmlLabel("ProgressDialogStatusMessageLabel"); statusMessageLabel.setText(" "); statusMessageLabel.setHorizontalAlignment(JLabel.CENTER); container.add(statusMessageLabel, new GridBagConstraints(0, 0, 1, 1, 0, 0, GridBagConstraints.CENTER, GridBagConstraints.HORIZONTAL, insetsDefault, 0, 0)); progressBar = skinsFactory.createSkinnedJProgressBar("ProgressDialogProgressBar", 0, 100); progressBar.setPreferredSize(new Dimension(550, 20)); container.add(progressBar, new GridBagConstraints(0, 1, 1, 1, 1, 0, GridBagConstraints.CENTER, GridBagConstraints.HORIZONTAL, insetsDefault, 0, 0)); detailsTextLabel = skinsFactory.createSkinnedJHtmlLabel("ProgressDialogDetailedMessageLabel"); detailsTextLabel.setText(" "); detailsTextLabel.setHorizontalAlignment(JLabel.CENTER); container.add(detailsTextLabel, new GridBagConstraints(0, 2, 1, 1, 0, 0, GridBagConstraints.CENTER, GridBagConstraints.HORIZONTAL, insetsDefault, 0, 0)); // Display the cancel button if a cancel event listener is available. cancelButton = skinsFactory.createSkinnedJButton("ProgressDialogCancelButton"); cancelButton.setText("Cancel"); cancelButton.setActionCommand("Cancel"); cancelButton.addActionListener(this); cancelButton.setDefaultCapable(true); container.add(cancelButton, new GridBagConstraints(0, 3, 1, 1, 0, 0, GridBagConstraints.CENTER, GridBagConstraints.NONE, insetsDefault, 0, 0)); // Set Cancel as the default operation when ESCAPE is pressed. this.getRootPane().getInputMap(JComponent.WHEN_IN_FOCUSED_WINDOW).put(KeyStroke.getKeyStroke("ESCAPE"), "ESCAPE"); this.getRootPane().getActionMap().put("ESCAPE", new AbstractAction() { private static final long serialVersionUID = 4397881858674185924L; public void actionPerformed(ActionEvent actionEvent) { cancelButton.doClick(); } }); this.getContentPane().add(container); this.pack(); this.setLocationRelativeTo(this.getOwner()); }
From source file:com.lp.client.frame.component.PanelDiagramm.java
public void eventYouAreSelected(boolean bNeedNoYouAreSelectedI) throws Throwable { jpaWorkingOn.removeAll();/*from ww w .j a va 2 s . c o m*/ diagrammDto = buildDiagrammDto(); if (diagrammDto.getJfcKapazitaetsvorschau() != null) { chartPanel = new ChartPanel(diagrammDto.getJfcKapazitaetsvorschau()); jpaWorkingOn.add(chartPanel, new GridBagConstraints(0, 0, 1, 1, 1.0, 1.0, GridBagConstraints.CENTER, GridBagConstraints.BOTH, new Insets(0, 0, 0, 0), 0, 0)); chartPanel.addChartMouseListener(this); } // Refreshknopf reaktivieren // updateButtons(new LockStateValue(null, null, PanelBasis.LOCK_IS_NOT_LOCKED)); super.eventYouAreSelected(false); }
From source file:StoppUhr.java
private void initGUI() { try {//from ww w . j a v a 2s .c om AnchorLayout thisLayout = new AnchorLayout(); getContentPane().setLayout(thisLayout); setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE); this.setPreferredSize(new java.awt.Dimension(609, 394)); { jPanel3 = new JPanel(); GridBagLayout jPanel3Layout = new GridBagLayout(); jPanel3.setLayout(jPanel3Layout); getContentPane().add(jPanel3, new AnchorConstraint(668, 811, 978, 19, AnchorConstraint.ANCHOR_REL, AnchorConstraint.ANCHOR_REL, AnchorConstraint.ANCHOR_REL, AnchorConstraint.ANCHOR_REL)); jPanel3.setPreferredSize(new java.awt.Dimension(384, 94)); { jScrollPane1 = new JScrollPane(); jPanel3.add(jScrollPane1, new GridBagConstraints(0, 0, 1, 1, 0.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.NONE, new Insets(0, 0, 0, 0), 0, 0)); jScrollPane1.setPreferredSize(new java.awt.Dimension(300, 90)); { jTextArea = new JTextArea(); jScrollPane1.setViewportView(jTextArea); jTextArea.setText(""); } } { jTextFieldStNr = new JTextField(); jPanel3.add(jTextFieldStNr, new GridBagConstraints(1, 0, 1, 1, 0.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.NONE, new Insets(0, 0, 0, 0), 0, 0)); jTextFieldStNr.setText(""); jTextFieldStNr.setPreferredSize(new java.awt.Dimension(150, 90)); jTextFieldStNr.setHorizontalAlignment(JTextField.CENTER); jTextFieldStNr.setFont(new Font(Font.DIALOG, Font.BOLD, 40)); } jPanel3Layout.rowWeights = new double[] { 0.1 }; jPanel3Layout.rowHeights = new int[] { 7 }; jPanel3Layout.columnWeights = new double[] { 0.1, 0.1 }; jPanel3Layout.columnWidths = new int[] { 7, 7 }; } { jPanel2 = new JPanel(); GridBagLayout jPanel2Layout = new GridBagLayout(); jPanel2Layout.rowWeights = new double[] { 0.1, 0.1 }; jPanel2Layout.rowHeights = new int[] { 7, 7 }; jPanel2Layout.columnWeights = new double[] { 0.1 }; jPanel2Layout.columnWidths = new int[] { 7 }; jPanel2.setLayout(jPanel2Layout); getContentPane().add(jPanel2, new AnchorConstraint(47, 821, 721, 27, AnchorConstraint.ANCHOR_REL, AnchorConstraint.ANCHOR_REL, AnchorConstraint.ANCHOR_REL, AnchorConstraint.ANCHOR_REL)); jPanel2.setPreferredSize(new java.awt.Dimension(363, 178)); { uhrzeitAusgabe = new JLabel(); jPanel2.add(uhrzeitAusgabe, new GridBagConstraints(0, 0, 1, 1, 0.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.NONE, new Insets(0, 0, 0, 0), 0, 0)); uhrzeitAusgabe.setText("00:00:00"); uhrzeitAusgabe.setFont(new Font(Font.DIALOG, Font.BOLD, uhrFontSize)); } { stoppuhrAusgabe = new JLabel(); jPanel2.add(stoppuhrAusgabe, new GridBagConstraints(0, 1, 1, 1, 0.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.NONE, new Insets(0, 0, 0, 0), 0, 0)); stoppuhrAusgabe.setText("00:00:00"); stoppuhrAusgabe.setFont(new Font(Font.DIALOG, Font.BOLD, uhrFontSize)); } } { jPanel1 = new JPanel(); GridBagLayout jPanel1Layout = new GridBagLayout(); getContentPane().add(jPanel1, new AnchorConstraint(48, 987, 954, 820, AnchorConstraint.ANCHOR_REL, AnchorConstraint.ANCHOR_REL, AnchorConstraint.ANCHOR_REL, AnchorConstraint.ANCHOR_REL)); jPanel1Layout.rowWeights = new double[] { 0.1, 0.1, 0.1, 1.0, 0.1 }; jPanel1Layout.rowHeights = new int[] { 1, 1, 1, 1, 1 }; jPanel1Layout.columnWeights = new double[] { 0.1 }; jPanel1Layout.columnWidths = new int[] { 7 }; jPanel1.setLayout(jPanel1Layout); jPanel1.setPreferredSize(new java.awt.Dimension(100, 330)); { startButton = new JButton(); jPanel1.add(startButton, new GridBagConstraints(0, 0, 1, 1, 0.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.NONE, new Insets(0, 0, 0, 0), 0, 0)); startButton.setPreferredSize(new java.awt.Dimension(90, 30)); startButton.setText("Start"); } { resetButton = new JButton(); jPanel1.add(resetButton, new GridBagConstraints(0, 1, 1, 1, 0.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.NONE, new Insets(0, 0, 0, 0), 0, 0)); resetButton.setText("Reset"); resetButton.setPreferredSize(new java.awt.Dimension(90, 30)); } { jPanel4 = new JPanel(); GridBagLayout jPanel4Layout = new GridBagLayout(); jPanel1.add(jPanel4, new GridBagConstraints(0, 4, 1, 1, 0.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.NONE, new Insets(0, 0, 0, 0), 0, 0)); jPanel4.setPreferredSize(new java.awt.Dimension(51, 81)); jPanel4Layout.rowWeights = new double[] { 0.1, 0.1, 0.1 }; jPanel4Layout.rowHeights = new int[] { 7, 7, 7 }; jPanel4Layout.columnWeights = new double[] { 0.1 }; jPanel4Layout.columnWidths = new int[] { 7 }; jPanel4.setLayout(jPanel4Layout); { plusButton = new JButton(); jPanel4.add(plusButton, new GridBagConstraints(0, 1, 1, 1, 0.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.NONE, new Insets(0, 0, 0, 0), 0, 0)); plusButton.setText("+"); plusButton.setPreferredSize(new java.awt.Dimension(50, 30)); } { minusButton = new JButton(); jPanel4.add(minusButton, new GridBagConstraints(0, 2, 1, 1, 0.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.NONE, new Insets(0, 0, 0, 0), 0, 0)); minusButton.setText("-"); minusButton.setPreferredSize(new java.awt.Dimension(50, 30)); } { jLabelFontSize = new JLabel(); jPanel4.add(jLabelFontSize, new GridBagConstraints(0, 0, 1, 1, 0.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.NONE, new Insets(0, 0, 0, 0), 0, 0)); jLabelFontSize.setFont(new Font(Font.DIALOG, Font.PLAIN, 10)); jLabelFontSize.setText("Font Size"); } } } this.addWindowListener(new WindowAdapter() { public void windowClosing(WindowEvent evt) { thisWindowClosing(evt); } }); startButton.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { startButtonListener(evt); } }); resetButton.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { resetButtonListener(evt); } }); jTextFieldStNr.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { try { stNrFieldListener(evt); } catch (IOException e) { e.printStackTrace(); } } }); plusButton.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { plusButtonListener(evt); } }); minusButton.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { minusButtonListener(evt); } }); pack(); this.setSize(609, 394); } catch (Exception e) { //add your error handling code here e.printStackTrace(); } }
From source file:it.cnr.icar.eric.client.ui.swing.DiscoveryPanel.java
/** * Class Constructor.//from w w w . ja va 2s. com */ public DiscoveryPanel() throws JAXRException { GridBagLayout gbl = new GridBagLayout(); setLayout(gbl); findParamsPanel = new FindParamsPanel(this); JPanel findResultsPanel = createFindResultsPanel(); JSplitPane splitPane = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT, findParamsPanel, findResultsPanel); c.gridx = 0; c.gridy = 0; c.gridwidth = 1; c.gridheight = 1; c.weightx = 0.5; c.weighty = 0.5; c.fill = GridBagConstraints.BOTH; c.anchor = GridBagConstraints.CENTER; c.insets = new Insets(4, 4, 4, 4); gbl.setConstraints(splitPane, c); add(splitPane); //add listener for 'locale' bound property RegistryBrowser.getInstance().addPropertyChangeListener(RegistryBrowser.PROPERTY_LOCALE, this); }
From source file:org.zaproxy.zap.extension.openapi.ImportFromUrlDialog.java
public ImportFromUrlDialog(JFrame parent, ExtensionOpenApi caller) { super(parent, true); this.setTitle(Constant.messages.getString(MESSAGE_PREFIX + "title")); this.caller = caller; if (parent != null) { Dimension parentSize = parent.getSize(); Point p = parent.getLocation(); setLocation(p.x + parentSize.width / 4, p.y + parentSize.height / 4); }/*from w w w . j a v a 2s .com*/ // set up layout setLayout(new GridBagLayout()); GridBagConstraints constraints = new GridBagConstraints(); constraints.anchor = GridBagConstraints.WEST; constraints.insets = new Insets(5, 5, 5, 5); buttonImport.addActionListener(this); buttonCancel.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { ImportFromUrlDialog.this.setVisible(false); ImportFromUrlDialog.this.dispose(); } }); // add components to the frame constraints.gridx = 0; constraints.gridy = 0; add(new JLabel(Constant.messages.getString(MESSAGE_PREFIX + "labelurl")), constraints); constraints.gridx = 1; constraints.fill = GridBagConstraints.HORIZONTAL; constraints.weightx = 1.0; constraints.gridwidth = 2; fieldURL = addContextMenu(fieldURL); add(fieldURL, constraints); constraints.gridx = 0; constraints.gridy = 1; add(new JLabel(Constant.messages.getString(MESSAGE_PREFIX + "labeloverride")), constraints); constraints.gridx = 1; constraints.fill = GridBagConstraints.HORIZONTAL; constraints.weightx = 1.0; constraints.gridwidth = 2; add(siteOverride, constraints); constraints.gridwidth = 1; constraints.gridy = 2; constraints.anchor = GridBagConstraints.CENTER; add(buttonCancel, constraints); constraints.gridx = 2; constraints.gridy = 2; constraints.anchor = GridBagConstraints.CENTER; add(buttonImport, constraints); setDefaultCloseOperation(DISPOSE_ON_CLOSE); pack(); setVisible(true); }
From source file:org.bench4Q.console.ui.section.S_SPSSection.java
/** * @param resources//from w w w . ja v a 2 s . co m * @param processControl * @param dispatcherFactory * @param TotalOrNot * @param agentIdentity * @param agentsCollection * @throws ConsoleException */ public S_SPSSection(Resources resources, ProcessControl processControl, SwingDispatcherFactory dispatcherFactory, Boolean TotalOrNot, AgentIdentity agentIdentity, AgentsCollection agentsCollection) throws ConsoleException { m_resources = resources; m_processControl = processControl; m_swingDispatcherFactory = dispatcherFactory; m_agentIdentity = agentIdentity; m_agentsCollection = agentsCollection; m_agentsCollection.registerObserver(this); this.TotalOrNot = TotalOrNot; this.setLayout(new GridBagLayout()); this.setPreferredSize(new Dimension(683, 475)); this.setMinimumSize(new Dimension(683, 475)); testduring = -1; resultNumber = 0; picPanel = new PicPanel(); this.add(picPanel, new GridBagConstraints(0, 0, 1, 4, 99.0, 99.0, GridBagConstraints.CENTER, GridBagConstraints.BOTH, new Insets(0, 0, 0, 0), 1, 1)); }
From source file:org.bench4Q.console.ui.section.E_ErrorSection.java
/** * @param resources/*from ww w . ja va2s . com*/ * @param processControl * @param TotalOrNot * @param agentIdentity * @param agentsCollection */ public E_ErrorSection(Resources resources, ProcessControl processControl, Boolean TotalOrNot, AgentIdentity agentIdentity, AgentsCollection agentsCollection) { m_resources = resources; m_processControl = processControl; this.TotalOrNot = TotalOrNot; m_agentIdentity = agentIdentity; m_agentsCollection = agentsCollection; m_agentsCollection.registerObserver(this); errors = new ErrorSet[15]; testduring = -1; this.setLayout(new GridBagLayout()); this.setPreferredSize(new Dimension(683, 475)); this.setMinimumSize(new Dimension(683, 475)); picPanel = new PicPanel(); this.add(picPanel, new GridBagConstraints(0, 0, 1, 5, 99.0, 99.0, GridBagConstraints.CENTER, GridBagConstraints.BOTH, new Insets(0, 0, 0, 0), 1, 1)); }