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.marginallyclever.makelangelo.MainGUI.java
protected boolean ChooseImageConversionOptions(boolean isDXF) { final JDialog driver = new JDialog(mainframe, translator.get("ConversionOptions"), true); driver.setLayout(new GridBagLayout()); final String[] choices = machineConfiguration.getKnownMachineNames(); final JComboBox<String> machine_choice = new JComboBox<String>(choices); machine_choice.setSelectedIndex(machineConfiguration.getCurrentMachineIndex()); final JSlider input_paper_margin = new JSlider(JSlider.HORIZONTAL, 0, 50, 100 - (int) (machineConfiguration.paper_margin * 100)); input_paper_margin.setMajorTickSpacing(10); input_paper_margin.setMinorTickSpacing(5); input_paper_margin.setPaintTicks(false); input_paper_margin.setPaintLabels(true); //final JCheckBox allow_metrics = new JCheckBox(String.valueOf("I want to add the distance drawn to the // total")); //allow_metrics.setSelected(allowMetrics); final JCheckBox reverse_h = new JCheckBox(translator.get("FlipForGlass")); reverse_h.setSelected(machineConfiguration.reverseForGlass); final JButton cancel = new JButton(translator.get("Cancel")); final JButton save = new JButton(translator.get("Start")); String[] filter_names = new String[image_converters.size()]; Iterator<Filter> fit = image_converters.iterator(); int i = 0;/*from w ww . j a v a2s . co m*/ while (fit.hasNext()) { Filter f = fit.next(); filter_names[i++] = f.GetName(); } final JComboBox<String> input_draw_style = new JComboBox<String>(filter_names); input_draw_style.setSelectedIndex(GetDrawStyle()); GridBagConstraints c = new GridBagConstraints(); //c.gridwidth=4; c.gridx=0; c.gridy=0; driver.add(allow_metrics,c); int y = 0; c.anchor = GridBagConstraints.EAST; c.gridwidth = 1; c.gridx = 0; c.gridy = y; driver.add(new JLabel(translator.get("MenuLoadMachineConfig")), c); c.anchor = GridBagConstraints.WEST; c.gridwidth = 2; c.gridx = 1; c.gridy = y++; driver.add(machine_choice, c); if (!isDXF) { c.anchor = GridBagConstraints.EAST; c.gridwidth = 1; c.gridx = 0; c.gridy = y; driver.add(new JLabel(translator.get("ConversionStyle")), c); c.anchor = GridBagConstraints.WEST; c.gridwidth = 3; c.gridx = 1; c.gridy = y++; driver.add(input_draw_style, c); } c.anchor = GridBagConstraints.EAST; c.gridwidth = 1; c.gridx = 0; c.gridy = y; driver.add(new JLabel(translator.get("PaperMargin")), c); c.anchor = GridBagConstraints.WEST; c.gridwidth = 3; c.gridx = 1; c.gridy = y++; driver.add(input_paper_margin, c); c.anchor = GridBagConstraints.WEST; c.gridwidth = 1; c.gridx = 1; c.gridy = y++; driver.add(reverse_h, c); c.anchor = GridBagConstraints.EAST; c.gridwidth = 1; c.gridx = 2; c.gridy = y; driver.add(save, c); c.anchor = GridBagConstraints.WEST; c.gridwidth = 1; c.gridx = 3; c.gridy = y++; driver.add(cancel, c); startConvertingNow = false; ActionListener driveButtons = new ActionListener() { public void actionPerformed(ActionEvent e) { Object subject = e.getSource(); if (subject == save) { long new_uid = Long.parseLong(choices[machine_choice.getSelectedIndex()]); machineConfiguration.LoadConfig(new_uid); SetDrawStyle(input_draw_style.getSelectedIndex()); machineConfiguration.paper_margin = (100 - input_paper_margin.getValue()) * 0.01; machineConfiguration.reverseForGlass = reverse_h.isSelected(); machineConfiguration.SaveConfig(); // if we aren't connected, don't show the new if (connectionToRobot != null && !connectionToRobot.isRobotConfirmed()) { // Force update of graphics layout. previewPane.updateMachineConfig(); // update window title mainframe.setTitle( translator.get("TitlePrefix") + Long.toString(machineConfiguration.robot_uid) + translator.get("TitleNotConnected")); } startConvertingNow = true; driver.dispose(); } if (subject == cancel) { driver.dispose(); } } }; save.addActionListener(driveButtons); cancel.addActionListener(driveButtons); driver.getRootPane().setDefaultButton(save); driver.pack(); driver.setVisible(true); return startConvertingNow; }
From source file:com.sec.ose.osi.ui.frm.main.identification.stringmatch.JPanStringMatchMain.java
public JPanel getJPanelLicenseFolder() { if (jPanelLicenseFolder == null) { GridBagConstraints gridBagConstraints13 = new GridBagConstraints(); gridBagConstraints13.anchor = GridBagConstraints.WEST; gridBagConstraints13.fill = GridBagConstraints.HORIZONTAL; gridBagConstraints13.insets = new Insets(0, 0, 5, 0); gridBagConstraints13.gridx = 1;/* w w w . j a v a 2 s .c o m*/ gridBagConstraints13.gridy = 0; gridBagConstraints13.gridwidth = 1; gridBagConstraints13.weightx = 1.0; GridBagConstraints gridBagConstraints11 = new GridBagConstraints(); gridBagConstraints11.gridx = 0; gridBagConstraints11.insets = new Insets(0, 0, 5, 3); gridBagConstraints11.gridy = 0; GridBagConstraints gridBagConstraints4 = new GridBagConstraints(); gridBagConstraints4.anchor = GridBagConstraints.WEST; gridBagConstraints4.fill = GridBagConstraints.HORIZONTAL; gridBagConstraints4.insets = new Insets(0, 0, 0, 0); gridBagConstraints4.gridx = -1; gridBagConstraints4.gridy = 1; gridBagConstraints4.gridwidth = 1; gridBagConstraints4.weightx = 0.0; GridBagConstraints gridBagConstraints2 = new GridBagConstraints(); gridBagConstraints2.anchor = GridBagConstraints.EAST; gridBagConstraints2.insets = new Insets(0, 0, 0, 3); gridBagConstraints2.gridx = -1; gridBagConstraints2.gridy = 1; gridBagConstraints2.ipadx = 0; gridBagConstraints2.weightx = 0.0; gridBagConstraints2.fill = GridBagConstraints.NONE; jPanelLicenseFolder = new JPanel(); jPanelLicenseFolder.setLayout(new GridBagLayout()); jPanelLicenseFolder.setPreferredSize(new Dimension(403, 66)); jPanelLicenseFolder.add(jLabelLicenseForOpt1, gridBagConstraints2); jPanelLicenseFolder.add(getJComboLicenseNameForOpt1(), gridBagConstraints4); jPanelLicenseFolder.add(jLabelComponentForOpt1, gridBagConstraints11); jPanelLicenseFolder.add(getJComboBoxComponent(), gridBagConstraints13); } return jPanelLicenseFolder; }
From source file:org.executequery.gui.browser.TableDataTab.java
private void initRowCountPanel() { rowCountField = new DisabledField(); rowCountPanel = new JPanel(new GridBagLayout()); GridBagConstraints gbc = new GridBagConstraints(); gbc.gridy = 0;// w w w .java2 s.com gbc.gridx = 0; gbc.fill = GridBagConstraints.NONE; gbc.anchor = GridBagConstraints.WEST; rowCountPanel.add(new JLabel("Data Row Count:"), gbc); gbc.gridx = 2; gbc.insets.bottom = 2; gbc.insets.left = 5; gbc.weightx = 1.0; gbc.fill = GridBagConstraints.HORIZONTAL; gbc.insets.right = 0; rowCountPanel.add(rowCountField, gbc); }
From source file:org.prom5.analysis.performance.PerformanceAnalysisGUI.java
/** * Actually builds the UI//w w w . j a v a 2 s . c o m * @throws Exception */ private void jbInit() throws Exception { //Initialize the table which contains the log traces processInstanceIDsTable = new DoubleClickTable(new ExtendedLogTable(), updateButton); // select all rows as at the beginning the results count for the whole log processInstanceIDsTable.getSelectionModel().addSelectionInterval(0, extendedLog.getSizeOfLog() - 1); tableContainer = new JScrollPane(processInstanceIDsTable); //initialize the westPanel (which contains the processInstanceIDsTable) westPanel.setPreferredSize(new Dimension(100, 300)); westPanel.setLayout(new BorderLayout()); westPanel.add(tableContainer, BorderLayout.CENTER); updateButton.setToolTipText("Update metrics to the selected process instances"); westPanel.add(piButtonsPanel, BorderLayout.SOUTH); piButtonsPanel.setLayout(new BorderLayout()); piButtonsPanel.add(updateButton, BorderLayout.CENTER); piButtonsPanel.add(invertButton, BorderLayout.SOUTH); //initialize the eastpanel (which contains the process-metrics) eastPanel.setPreferredSize(new Dimension(240, 390)); eastPanel.setMinimumSize(new Dimension(240, 390)); eastPanel.setLayout(new GridBagLayout()); GridBagConstraints cons = new GridBagConstraints(); cons.gridx = 0; cons.gridy = 0; cons.insets = new Insets(0, 5, 5, 0); cons.anchor = GridBagConstraints.WEST; processLabel.setFont(new Font("SansSerif", Font.BOLD, 16)); eastPanel.add(processLabel, cons); cons.gridx = 0; cons.gridy = 1; cons.insets = new Insets(8, 8, 0, 0); eastPanel.add(numberProcessLabel, cons); casesProcessLabel.setText(extendedLog.getSizeOfLog() + " cases"); casesProcessLabel.setFont(new Font("SansSerif", Font.PLAIN, 11)); cons.gridx = 0; cons.gridy = 2; eastPanel.add(casesProcessLabel, cons); cons.gridx = 0; cons.gridy = 3; eastPanel.add(properLabel, cons); completedLabel.setFont(new Font("SansSerif", Font.PLAIN, 11)); cons.gridx = 0; cons.gridy = 4; eastPanel.add(completedLabel, cons); cons.gridx = 0; cons.gridy = 5; eastPanel.add(arrivalProcessLabel, cons); rateProcessLabel.setFont(new Font("SansSerif", Font.PLAIN, 11)); cons.gridx = 0; cons.gridy = 6; eastPanel.add(rateProcessLabel, cons); cons.gridx = 0; cons.gridy = 7; cons.gridwidth = 2; cons.insets = new Insets(15, 5, 0, 2); cons.ipadx = 300; eastPanel.add(processTablePanel, cons); cons.gridx = 0; cons.gridy = 8; cons.gridwidth = 1; cons.insets = new Insets(0, 5, 0, 0); cons.weightx = 1; cons.ipadx = 0; exportProcessButton.setPreferredSize(new Dimension(110, 42)); exportProcessButton.setMaximumSize(new Dimension(110, 42)); changeProcessPercButton.setPreferredSize(new Dimension(110, 42)); changeProcessPercButton.setMaximumSize(new Dimension(110, 42)); JPanel buttonPanel = new JPanel(); buttonPanel.setLayout(new BoxLayout(buttonPanel, BoxLayout.X_AXIS)); buttonPanel.setPreferredSize(new Dimension(240, 42)); buttonPanel.add(changeProcessPercButton); buttonPanel.add(exportProcessButton); eastPanel.add(buttonPanel, cons); processContainer = new JScrollPane(eastPanel); processContainer.setPreferredSize(new Dimension(240, 390)); //initialize the processTablePanel (which contains the table with throughput times) processTablePanel.setLayout(new BorderLayout()); processTablePanel.setMinimumSize(new Dimension(240, 130)); processTablePanel.setPreferredSize(new Dimension(240, 130)); processTable.setRowSelectionAllowed(false); processTablePanel.add(processTable.getTableHeader(), BorderLayout.PAGE_START); processTablePanel.add(processTable, BorderLayout.CENTER); //initialize the grappaPanel (which contains the Petri net UI) and place //it on the centerPanel grappaPanel = replayResult.getVisualization(extendedLog.getLogTraceIDs()); grappaPanel.addGrappaListener(new ExtendedGrappaAdapter()); mapping = new HashMap(); buildGraphMapping(mapping, grappaPanel.getSubgraph()); modelContainer = new JScrollPane(grappaPanel); centerPanel.setLayout(new BorderLayout()); centerPanel.add(modelContainer, BorderLayout.CENTER); //initialize the colored panels Color tCol = (Color) levelColors.get(0); lowPanel.setBackground(tCol); lowPanel.setBorder(BorderFactory.createEtchedBorder()); lowPanel.setPreferredSize(new Dimension(25, 12)); tCol = (Color) levelColors.get(1); mediumPanel.setBackground(tCol); mediumPanel.setBorder(BorderFactory.createEtchedBorder()); mediumPanel.setPreferredSize(new Dimension(25, 12)); tCol = (Color) levelColors.get(2); highPanel.setBackground(tCol); highPanel.setBorder(BorderFactory.createEtchedBorder()); highPanel.setPreferredSize(new Dimension(25, 12)); //initialize the levelPanel (which contains the waiting time settings) levelPanel.setBorder(BorderFactory.createRaisedBevelBorder()); levelPanel.setLayout(new GridBagLayout()); cons.gridx = 0; cons.gridy = 0; cons.gridwidth = 2; cons.insets = new Insets(2, 2, 0, 5); cons.weightx = 0; levelPanel.add(waitingLabel, cons); cons.gridx = 0; cons.gridy = 1; cons.anchor = GridBagConstraints.WEST; cons.insets = new Insets(2, 2, 0, 5); cons.gridwidth = 1; levelPanel.add(highPanel, cons); cons.gridx = 1; cons.gridy = 1; levelPanel.add(highLabel, cons); cons.gridx = 0; cons.gridy = 2; cons.insets = new Insets(1, 2, 0, 5); levelPanel.add(mediumPanel, cons); cons.gridx = 1; cons.gridy = 2; levelPanel.add(mediumLabel, cons); cons.gridx = 0; cons.gridy = 3; cons.insets = new Insets(2, 2, 2, 5); levelPanel.add(lowPanel, cons); cons.gridx = 1; cons.gridy = 3; levelPanel.add(lowLabel, cons); cons.gridx = 0; cons.gridy = 4; cons.gridwidth = 2; cons.insets = new Insets(2, 2, 2, 2); changeSettingsButton.setMnemonic(KeyEvent.VK_S); levelPanel.add(changeSettingsButton, cons); levelPanel.setBackground(new Color(220, 220, 220)); //initialize the selectionPanel (which contains the selected transitions/place) initializeSelection(); //initialize the metricsBottomPanel metricsBottomPanel.setLayout(new GridBagLayout()); cons = new GridBagConstraints(); cons.gridx = 0; cons.gridy = 0; cons.gridwidth = 5; cons.anchor = GridBagConstraints.WEST; cons.insets = new Insets(1, 2, 5, 0); titleLabel.setFont(new Font("SansSerif", Font.BOLD, 14)); metricsBottomPanel.add(titleLabel, cons); cons.gridx = 0; cons.gridy = 1; cons.gridwidth = 1; cons.insets = new Insets(1, 2, 2, 0); metricsBottomPanel.add(numberObjectLabel, cons); cons.gridx = 1; cons.gridy = 1; cons.gridwidth = 1; freqObjectLabel.setFont(new Font("SansSerif", Font.PLAIN, 12)); metricsBottomPanel.add(freqObjectLabel, cons); cons.gridx = 0; cons.gridy = 2; cons.gridwidth = 1; metricsBottomPanel.add(arrivalPlaceLabel, cons); cons.gridx = 1; cons.gridy = 2; cons.gridwidth = 1; ratePlaceLabel.setFont(new Font("SansSerif", Font.PLAIN, 12)); metricsBottomPanel.add(ratePlaceLabel, cons); cons.gridx = 0; cons.gridy = 3; cons.gridwidth = 5; metricsBottomPanel.add(tablePanel, cons); cons.gridx = 0; cons.gridy = 4; cons.gridwidth = 2; changePercentagesButton.setPreferredSize(new Dimension(170, 25)); metricsBottomPanel.add(changePercentagesButton, cons); cons.gridx = 2; cons.gridy = 4; cons.gridwidth = 2; metricsBottomPanel.add(exportButton, cons); //hide all place/transition metrics hideAllMetrics(); metricsBottomContainer = new JScrollPane(metricsBottomPanel); metricsBottomContainer.setPreferredSize(new Dimension(550, 140)); metricsBottomContainer.setMinimumSize(new Dimension(550, 140)); metricsBottomContainer.setMaximumSize(new Dimension(550, 800)); metricsBottomContainer.setBorder(BorderFactory.createEmptyBorder()); //initialize the bottomPanel bottomPanel.setBorder(BorderFactory.createEtchedBorder()); bottomPanel.setPreferredSize(new Dimension(650, 143)); bottomPanel.setMinimumSize(new Dimension(650, 143)); bottomPanel.setLayout(new GridBagLayout()); GridBagConstraints con = new GridBagConstraints(); con.gridx = 0; con.gridy = 0; con.gridwidth = 4; con.weightx = 2; bottomPanel.add(metricsBottomContainer, con); con.gridx = 4; con.gridy = 0; con.gridwidth = 1; con.weightx = 1; con.anchor = GridBagConstraints.EAST; bottomPanel.add(levelPanel, con); con.gridx = 5; con.gridy = 0; //con.gridwidth = 2; con.weightx = 1; con.anchor = GridBagConstraints.EAST; bottomPanel.add(selectionPanel, con); //Divide the upper panels by using splitPanes leftSplitPane = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT, westPanel, centerPanel); leftSplitPane.setDividerLocation(130); leftSplitPane.setOneTouchExpandable(true); rightSplitPane = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT, leftSplitPane, processContainer); rightSplitPane.setDividerLocation(rightSplitPane.getSize().width - rightSplitPane.getInsets().right - rightSplitPane.getDividerSize() - 240); //processContainer.getWidth()); rightSplitPane.setOneTouchExpandable(true); rightSplitPane.setResizeWeight(1.0); rightSplitPane.setDividerSize(3); //set tooltips processTable.setToolTipText("Throughput time of the process, based on" + " the selected cases"); rateProcessLabel.setToolTipText("Arrival rate of the selected cases"); arrivalProcessLabel.setToolTipText("Arrival rate of the selected cases"); completedLabel.setToolTipText( "Total number of the selected cases that" + " have completed properly and successfully"); properLabel.setToolTipText( "Total number of the selected cases that" + " have completed properly and successfully"); casesProcessLabel.setToolTipText("Total number of cases selected in" + " the table on the left"); numberProcessLabel.setToolTipText("Total number of cases selected in" + " the table on the left"); changeSettingsButton.setToolTipText("Adjust the current waiting time" + " classifications"); placeTable.setToolTipText("Time-metrics of the selected place, based on" + " the selected cases"); transitionTable.setToolTipText( "Time cases spend in between the" + " selected transitions, based on the selected cases"); activityTable.setToolTipText( "Time-metrics of activity related to the" + " selected transition, based on the selected cases"); processInstanceIDsTable.setToolTipText("Selected cases"); changePercentagesButton.setToolTipText("Change percentages of slow," + " fast and normal"); changeProcessPercButton.setToolTipText("Change percentages of slow," + " fast and normal"); exportButton.setToolTipText("Export the values of all measurements of" + " the metrics in the table above to a comma-seperated" + " text-file"); exportProcessButton.setToolTipText("Export the value of the throughput" + " time of all selected process instances to a comma-seperated" + " text-file"); //initialize the performanceAnalysisGUI this.setLayout(new BorderLayout()); this.add(bottomPanel, BorderLayout.SOUTH); this.add(rightSplitPane, BorderLayout.CENTER); this.validate(); this.repaint(); }
From source file:org.jivesoftware.sparkimpl.plugin.viewer.PluginViewer.java
private void downloadPlugin(final PublicPlugin plugin) { // Prepare HTTP post final GetMethod post = new GetMethod(plugin.getDownloadURL()); // Get HTTP client Protocol.registerProtocol("https", new Protocol("https", new EasySSLProtocolSocketFactory(), 443)); final HttpClient httpclient = new HttpClient(); String proxyHost = System.getProperty("http.proxyHost"); String proxyPort = System.getProperty("http.proxyPort"); if (Default.getBoolean("PLUGIN_REPOSITORY_USE_PROXY")) { if (ModelUtil.hasLength(proxyHost) && ModelUtil.hasLength(proxyPort)) { try { httpclient.getHostConfiguration().setProxy(proxyHost, Integer.parseInt(proxyPort)); } catch (NumberFormatException e) { Log.error(e);//from w w w . j av a 2s.c o m } } } // Execute request try { int result = httpclient.executeMethod(post); if (result != 200) { return; } long length = post.getResponseContentLength(); int contentLength = (int) length; progressBar = new JProgressBar(0, contentLength); final JFrame frame = new JFrame(Res.getString("message.downloading", plugin.getName())); frame.setIconImage(SparkRes.getImageIcon(SparkRes.SMALL_MESSAGE_IMAGE).getImage()); final Thread thread = new Thread(new Runnable() { public void run() { try { Thread.sleep(2000); InputStream stream = post.getResponseBodyAsStream(); URL url = new URL(plugin.getDownloadURL()); String name = URLFileSystem.getFileName(url); String directoryName = URLFileSystem.getName(url); File pluginDownload = new File(PluginManager.PLUGINS_DIRECTORY, name); FileOutputStream out = new FileOutputStream(pluginDownload); copy(stream, out); out.close(); frame.dispose(); // Remove SparkPlugUI // Clear all selections Component[] comps = availablePanel.getComponents(); for (Component comp : comps) { if (comp instanceof SparkPlugUI) { SparkPlugUI sparkPlug = (SparkPlugUI) comp; if (sparkPlug.getPlugin().getDownloadURL().equals(plugin.getDownloadURL())) { availablePanel.remove(sparkPlug); _deactivatedPlugins.remove(sparkPlug.getPlugin().getName()); _prefs.setDeactivatedPlugins(_deactivatedPlugins); PluginManager.getInstance().addPlugin(sparkPlug.getPlugin()); sparkPlug.showOperationButton(); installedPanel.add(sparkPlug); sparkPlug.getPlugin() .setPluginDir(new File(PluginManager.PLUGINS_DIRECTORY, directoryName)); installedPanel.invalidate(); installedPanel.repaint(); availablePanel.invalidate(); availablePanel.invalidate(); availablePanel.validate(); availablePanel.repaint(); } } } } catch (Exception ex) { // Nothing to do } finally { // Release current connection to the connection pool once you are done post.releaseConnection(); } } }); frame.getContentPane().setLayout(new GridBagLayout()); frame.getContentPane().add(new JLabel(Res.getString("message.downloading.spark.plug")), new GridBagConstraints(0, 0, 1, 1, 1.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.HORIZONTAL, new Insets(5, 5, 5, 5), 0, 0)); frame.getContentPane().add(progressBar, new GridBagConstraints(0, 1, 1, 1, 1.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.HORIZONTAL, new Insets(5, 5, 5, 5), 0, 0)); frame.pack(); frame.setSize(400, 100); GraphicUtils.centerWindowOnComponent(frame, this); frame.setVisible(true); thread.start(); } catch (IOException e) { Log.error(e); } }
From source file:net.java.sip.communicator.gui.AuthenticationSplash.java
/** * The user has selected an option. Here we close and dispose the dialog. * If actionCommand is an ActionEvent, getCommandString() is called, * otherwise toString() is used to get the action command. * * @param actionCommand may be null/*w w w . java2 s . c om*/ */ private void registrationComponents() { Container contents = getContentPane(); contents.setLayout(new BorderLayout()); String title = Utils.getProperty("net.java.sip.communicator.gui.REG_WIN_TITLE"); if (title == null) title = "Registration Manager"; setTitle(title); setResizable(false); addWindowListener(new WindowAdapter() { public void windowClosing(WindowEvent event) { registrationDialogDone(CMD_CANCEL); } }); // Accessibility -- all frames, dialogs, and applets should // have a description getAccessibleContext().setAccessibleDescription("Registration Splash"); String authPromptLabelValue = Utils.getProperty("net.java.sip.communicator.gui.REGISTRATION_PROMPT"); if (authPromptLabelValue == null) authPromptLabelValue = "Please fill in the following fields to register:"; JLabel splashLabel = new JLabel(authPromptLabelValue); splashLabel.setBorder(BorderFactory.createEmptyBorder(10, 10, 10, 10)); splashLabel.setHorizontalAlignment(SwingConstants.CENTER); splashLabel.setHorizontalTextPosition(SwingConstants.CENTER); contents.add(splashLabel, BorderLayout.NORTH); JPanel centerPane = new JPanel(); centerPane.setLayout(new GridBagLayout()); /* My additions */ nameTextField = new JTextField(); //needed below // name label nameLabel = new JLabel(); nameLabel.setLabelFor(nameTextField); String nLabelStr = PropertiesDepot.getProperty("net.java.sip.communicator.gui.NAME_LABEL"); if (nLabelStr == null) nLabelStr = "Name"; nameLabel.setText(nLabelStr); int gridy = 0; GridBagConstraints c = new GridBagConstraints(); c.gridx = 0; c.gridy = gridy; c.anchor = GridBagConstraints.WEST; c.insets = new Insets(11, 12, 0, 0); centerPane.add(nameLabel, c); // name text c = new GridBagConstraints(); c.gridx = 1; c.gridy = gridy++; c.fill = GridBagConstraints.HORIZONTAL; c.weightx = 1.0; c.insets = new Insets(11, 7, 0, 11); centerPane.add(nameTextField, c); lastNameTextField = new JTextField(); //needed below // last name label lastNameLabel = new JLabel(); lastNameLabel.setLabelFor(nameTextField); String lnLabelStr = PropertiesDepot.getProperty("net.java.sip.communicator.gui.LAST_NAME_LABEL"); if (lnLabelStr == null) lnLabelStr = "Last Name"; lastNameLabel.setText(lnLabelStr); c = new GridBagConstraints(); c.gridx = 0; c.gridy = gridy; c.anchor = GridBagConstraints.WEST; c.insets = new Insets(11, 12, 0, 0); centerPane.add(lastNameLabel, c); // last name text c = new GridBagConstraints(); c.gridx = 1; c.gridy = gridy++; c.fill = GridBagConstraints.HORIZONTAL; c.weightx = 1.0; c.insets = new Insets(11, 7, 0, 11); centerPane.add(lastNameTextField, c); mailTextField = new JTextField(); //needed below // mail label mailLabel = new JLabel(); mailLabel.setLabelFor(mailTextField); String mLabelStr = PropertiesDepot.getProperty("net.java.sip.communicator.gui.MAIL_LABEL"); if (mLabelStr == null) mLabelStr = "Email"; mailLabel.setText(mLabelStr); c = new GridBagConstraints(); c.gridx = 0; c.gridy = gridy; c.anchor = GridBagConstraints.WEST; c.insets = new Insets(11, 12, 0, 0); centerPane.add(mailLabel, c); // mail text c = new GridBagConstraints(); c.gridx = 1; c.gridy = gridy++; c.fill = GridBagConstraints.HORIZONTAL; c.weightx = 1.0; c.insets = new Insets(11, 7, 0, 11); centerPane.add(mailTextField, c); /* END: MY additions */ userNameTextField = new JTextField(); // needed below // user name label userNameLabel = new JLabel(); userNameLabel.setLabelFor(userNameTextField); String userNameLabelValue = Utils.getProperty("net.java.sip.communicator.gui.USER_NAME_LABEL"); if (userNameLabelValue == null) userNameLabelValue = "Username"; userNameLabel.setText(userNameLabelValue); c = new GridBagConstraints(); c.gridx = 0; c.gridy = gridy; c.anchor = GridBagConstraints.WEST; c.insets = new Insets(12, 12, 0, 0); centerPane.add(userNameLabel, c); // user name text c = new GridBagConstraints(); c.gridx = 1; c.gridy = gridy++; c.fill = GridBagConstraints.HORIZONTAL; c.weightx = 1.0; c.insets = new Insets(12, 7, 0, 11); centerPane.add(userNameTextField, c); passwordTextField = new JPasswordField(); //needed below // password label passwordLabel = new JLabel(); passwordLabel.setLabelFor(passwordTextField); String pLabelStr = PropertiesDepot.getProperty("net.java.sip.communicator.gui.PASSWORD_LABEL"); if (pLabelStr == null) pLabelStr = "Password"; passwordLabel.setText(pLabelStr); c = new GridBagConstraints(); c.gridx = 0; c.gridy = gridy; c.anchor = GridBagConstraints.WEST; c.insets = new Insets(11, 12, 0, 0); centerPane.add(passwordLabel, c); // password text passwordTextField.setEchoChar('\u2022'); c = new GridBagConstraints(); c.gridx = 1; c.gridy = gridy++; c.fill = GridBagConstraints.HORIZONTAL; c.weightx = 1.0; c.insets = new Insets(11, 7, 0, 11); centerPane.add(passwordTextField, c); policyDropDown = new JComboBox(); policyDropDown.addItem("Basic"); policyDropDown.addItem("Pro"); policyDropDown.addItem("Enterprise"); // policy label policyLabel = new JLabel(); policyLabel.setLabelFor(policyDropDown); String plcLabelStr = PropertiesDepot.getProperty("net.java.sip.communicator.gui.POLICY_LABEL"); if (plcLabelStr == null) plcLabelStr = "Policy"; policyLabel.setText(plcLabelStr); c = new GridBagConstraints(); c.gridx = 0; c.gridy = gridy; c.anchor = GridBagConstraints.WEST; c.insets = new Insets(11, 12, 0, 0); centerPane.add(policyLabel, c); // policy menu c = new GridBagConstraints(); c.gridx = 1; c.gridy = gridy++; c.fill = GridBagConstraints.HORIZONTAL; c.weightx = 1.0; c.insets = new Insets(11, 7, 0, 11); centerPane.add(policyDropDown, c); JPanel buttonPanel = new JPanel(); buttonPanel.setLayout(new BoxLayout(buttonPanel, 0)); registerButton = new JButton(); registerButton.setMnemonic('G'); registerButton.setText("Register"); registerButton.setActionCommand(CMD_REGISTER); registerButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent event) { registrationDialogDone(event); } }); buttonPanel.add(registerButton); buttonPanel.add(Box.createRigidArea(new Dimension(5, 0))); cancelButton = new JButton(); cancelButton.setText("Cancel"); cancelButton.setActionCommand(CMD_CANCEL); cancelButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent event) { registrationDialogDone(event); } }); buttonPanel.add(cancelButton); c = new GridBagConstraints(); c.gridx = 0; c.gridy = 6; c.gridwidth = 2; c.insets = new Insets(11, 12, 11, 11); centerPane.add(buttonPanel, c); contents.add(centerPane, BorderLayout.CENTER); getRootPane().setDefaultButton(registerButton); registrationEqualizeButtonSizes(); setFocusTraversalPolicy(new FocusTraversalPol()); }
From source file:com.sec.ose.osi.ui.dialog.setting.JPanProjectAnalysisSetting.java
/** * This method initializes jIntMainPanel * //w ww . j av a 2 s .c o m * @return javax.swing.JPanel */ private JPanel getJIntMainPanel() { if (jIntMainPanel == null) { GridBagConstraints gridBagConstraintsSplit = new GridBagConstraints(); gridBagConstraintsSplit.anchor = GridBagConstraints.NORTHWEST; gridBagConstraintsSplit.weighty = 1.0; gridBagConstraintsSplit.insets = new Insets(5, 5, 0, 5); gridBagConstraintsSplit.fill = GridBagConstraints.HORIZONTAL; gridBagConstraintsSplit.weightx = 1.0; GridBagConstraints gridBagConstraintsMonitor = new GridBagConstraints(); gridBagConstraintsMonitor.anchor = GridBagConstraints.WEST; gridBagConstraintsMonitor.weighty = 1.0; gridBagConstraintsMonitor.insets = new Insets(5, 5, 0, 5); gridBagConstraintsMonitor.gridx = 0; gridBagConstraintsMonitor.gridy = 1; gridBagConstraintsMonitor.fill = GridBagConstraints.HORIZONTAL; gridBagConstraintsMonitor.weightx = 1.0; jIntMainPanel = new JPanel(); jIntMainPanel.setLayout(new GridBagLayout()); jIntMainPanel.setBorder(BorderFactory.createTitledBorder(null, "", TitledBorder.DEFAULT_JUSTIFICATION, TitledBorder.DEFAULT_POSITION, new Font("Dialog", Font.BOLD, 12), new Color(51, 51, 51))); jIntMainPanel.add(getJPanelProjectSplit(), gridBagConstraintsSplit); jIntMainPanel.add(getJPanelMonitorInterval(), gridBagConstraintsMonitor); } return jIntMainPanel; }
From source file:org.pentaho.reporting.libraries.designtime.swing.table.ArrayCellEditorDialog.java
private void configurePanelWithoutSelection() { final JLabel columnsLabel = new JLabel( Messages.getInstance().getString("ArrayCellEditorDialog.SelectedItems")); final ListSelectionModel selectionModel = table.getSelectionModel(); final Action addGroupAction = new AddEntryAction(tableModel); final Action removeGroupAction = new RemoveEntryAction(tableModel, selectionModel); final Action sortUpAction = new SortBulkUpAction(tableModel, selectionModel, table); final Action sortDownAction = new SortBulkDownAction(tableModel, selectionModel, table); final JPanel tablesPane = new JPanel(); tablesPane.setLayout(new GridBagLayout()); GridBagConstraints gbc = new GridBagConstraints(); gbc.anchor = GridBagConstraints.WEST; gbc.gridx = 2;//from ww w.j a v a 2 s.co m gbc.gridy = 2; gbc.weightx = 1; gbc.fill = GridBagConstraints.HORIZONTAL; gbc.insets = new Insets(5, 5, 5, 5); tablesPane.add(columnsLabel, gbc); gbc = new GridBagConstraints(); gbc.gridx = 3; gbc.gridy = 2; gbc.insets = new Insets(5, 5, 5, 5); tablesPane.add(new BorderlessButton(sortUpAction), gbc); gbc = new GridBagConstraints(); gbc.gridx = 4; gbc.gridy = 2; gbc.insets = new Insets(5, 5, 5, 5); tablesPane.add(new BorderlessButton(sortDownAction), gbc); gbc = new GridBagConstraints(); gbc.gridx = 5; gbc.gridy = 2; gbc.insets = new Insets(5, 5, 5, 5); tablesPane.add(new BorderlessButton(addGroupAction), gbc); gbc = new GridBagConstraints(); gbc.gridx = 6; gbc.gridy = 2; gbc.insets = new Insets(5, 5, 5, 5); tablesPane.add(new BorderlessButton(removeGroupAction), gbc); gbc = new GridBagConstraints(); gbc.gridx = 2; gbc.gridy = 3; gbc.weighty = 1; gbc.fill = GridBagConstraints.BOTH; gbc.gridwidth = 5; gbc.insets = new Insets(0, 5, 5, 0); tablesPane.add(new JScrollPane(table, JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED, JScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED), gbc); contentPane.removeAll(); contentPane.add(tablesPane); contentPane.invalidate(); contentPane.revalidate(); contentPane.repaint(); }
From source file:com.intuit.tank.tools.script.ScriptFilterRunner.java
/** * @param x/*from www . ja va 2 s .co m*/ * @param y * @return */ private GridBagConstraints getConstraints(int x, int y, int fill) { GridBagConstraints ret = new GridBagConstraints(x, y, 1, 1, x, .5D, GridBagConstraints.WEST, fill, new Insets(5, 5, 5, 5), 5, 5); return ret; }
From source file:org.openconcerto.erp.core.supplychain.order.component.CommandeSQLComponent.java
public void addViews() { this.setLayout(new GridBagLayout()); final GridBagConstraints c = new DefaultGridBagConstraints(); // Numero du commande c.gridx = 0;/*from w w w .j a v a2 s . c o m*/ c.weightx = 0; this.add(new JLabel(getLabelFor("NUMERO"), SwingConstants.RIGHT), c); this.numeroUniqueCommande = new JUniqueTextField(16); c.gridx++; c.weightx = 1; c.fill = GridBagConstraints.NONE; DefaultGridBagConstraints.lockMinimumSize(numeroUniqueCommande); this.add(this.numeroUniqueCommande, c); // Date JLabel labelDate = new JLabel(getLabelFor("DATE")); labelDate.setHorizontalAlignment(SwingConstants.RIGHT); c.gridx = 2; c.weightx = 0; c.fill = GridBagConstraints.HORIZONTAL; this.add(labelDate, c); JDate dateCommande = new JDate(true); c.gridx++; c.fill = GridBagConstraints.NONE; this.add(dateCommande, c); // Fournisseur c.gridx = 0; c.gridy++; c.weightx = 0; c.fill = GridBagConstraints.HORIZONTAL; this.add(new JLabel(getLabelFor("ID_FOURNISSEUR"), SwingConstants.RIGHT), c); c.gridx = GridBagConstraints.RELATIVE; c.gridwidth = 1; c.weightx = 1; c.weighty = 0; c.fill = GridBagConstraints.NONE; this.add(this.fourn, c); if (!getTable().getFieldsName().contains("LIVRER")) { // Commande en cours JCheckBox boxEnCours = new JCheckBox(getLabelFor("EN_COURS")); c.gridx = 2; c.weightx = 0; c.fill = GridBagConstraints.HORIZONTAL; c.gridwidth = GridBagConstraints.REMAINDER; this.add(boxEnCours, c); c.gridwidth = 1; this.addRequiredSQLObject(boxEnCours, "EN_COURS"); } // Fournisseur if (getTable().contains("ID_CONTACT_FOURNISSEUR")) { c.gridx = 0; c.gridy++; c.weightx = 0; c.fill = GridBagConstraints.HORIZONTAL; this.add(new JLabel(getLabelFor("ID_CONTACT_FOURNISSEUR"), SwingConstants.RIGHT), c); c.gridx = GridBagConstraints.RELATIVE; c.gridwidth = 1; c.weightx = 1; c.weighty = 0; c.fill = GridBagConstraints.HORIZONTAL; final ElementComboBox boxContactFournisseur = new ElementComboBox(); final SQLElement contactElement = Configuration.getInstance().getDirectory() .getElement("CONTACT_FOURNISSEUR"); boxContactFournisseur.init(contactElement, contactElement.getComboRequest(true)); this.add(boxContactFournisseur, c); this.addView(boxContactFournisseur, "ID_CONTACT_FOURNISSEUR", REQ); fourn.addValueListener(new PropertyChangeListener() { @Override public void propertyChange(PropertyChangeEvent arg0) { // TODO Raccord de mthode auto-gnr if (fourn.getSelectedRow() != null) { boxContactFournisseur.getRequest() .setWhere(new Where(contactElement.getTable().getField("ID_FOURNISSEUR"), "=", fourn.getSelectedRow().getID())); } else { boxContactFournisseur.getRequest().setWhere(null); } } }); } // Adresse de livraison if (getTable().getFieldsName().contains("ID_ADRESSE")) { if (getTable().getFieldsName().contains("LIVRAISON_F")) { c.gridx = 0; c.gridy++; c.weightx = 0; c.fill = GridBagConstraints.HORIZONTAL; this.add(new JLabel(getLabelFor("ID_ADRESSE")), c); c.gridx++; c.gridwidth = GridBagConstraints.REMAINDER; // c.gridy++; this.addView("ID_ADRESSE"); final DefaultElementSQLObject comp = (DefaultElementSQLObject) this.getView("ID_ADRESSE").getComp(); if (getTable().getFieldsName().contains("LIVRAISON_F")) { final JCheckBox boxLivr = new JCheckBox("Livr par le fournisseur"); this.add(boxLivr, c); this.addSQLObject(boxLivr, "LIVRAISON_F"); boxLivr.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { if (boxLivr.isSelected() && !comp.isCreated()) { comp.setCreated(true); if (CommandeSQLComponent.this.getTable().contains("ID_AFFAIRE")) { SQLRowValues rowVals = getLivraisonAdr( ((ElementComboBox) CommandeSQLComponent.this.getView("ID_AFFAIRE") .getComp()).getSelectedRow()); comp.setValue(rowVals); } } else { if (!boxLivr.isSelected()) { comp.setCreated(false); } } } }); } c.gridy++; this.add(comp, c); this.add(this.getView("ID_ADRESSE").getComp(), c); } else { c.gridy++; c.gridx = 0; this.add(new JLabel("Livraison"), c); c.gridx++; c.gridwidth = GridBagConstraints.REMAINDER; this.add(boxLivrClient, c); c.gridwidth = 1; final GridBagConstraints cAdr = new DefaultGridBagConstraints(); panelAdrSpec.add(new JLabel(getLabelFor("ID_CLIENT"), SwingConstants.RIGHT), cAdr); final ElementComboBox boxClient = new ElementComboBox(true); cAdr.weightx = 1; cAdr.gridx++; panelAdrSpec.add(boxClient, cAdr); this.addView(boxClient, "ID_CLIENT"); cAdr.gridy++; cAdr.weightx = 0; cAdr.gridx = 0; panelAdrSpec.add(new JLabel("Adresse", SwingConstants.RIGHT), cAdr); final SQLRequestComboBox boxAdr = new SQLRequestComboBox(true); boxAdr.uiInit(Configuration.getInstance().getDirectory().getElement(getTable().getTable("ADRESSE")) .getComboRequest(true)); boxClient.addModelListener("wantedID", new PropertyChangeListener() { @Override public void propertyChange(PropertyChangeEvent evt) { if (boxClient.getSelectedRow() != null && !boxClient.getSelectedRow().isUndefined()) { Where w = new Where(boxAdr.getRequest().getPrimaryTable().getField("ID_CLIENT"), "=", boxClient.getSelectedRow().getID()); w = w.or(new Where(boxAdr.getRequest().getPrimaryTable().getKey(), "=", boxClient.getSelectedRow().getInt("ID_ADRESSE"))); w = w.or(new Where(boxAdr.getRequest().getPrimaryTable().getKey(), "=", boxClient.getSelectedRow().getInt("ID_ADRESSE_F"))); w = w.or(new Where(boxAdr.getRequest().getPrimaryTable().getKey(), "=", boxClient.getSelectedRow().getInt("ID_ADRESSE_L"))); boxAdr.getRequest().setWhere(w); } else { boxAdr.getRequest().setWhere(null); } } }); cAdr.weightx = 1; cAdr.gridx++; panelAdrSpec.add(boxAdr, cAdr); cAdr.gridx = 0; cAdr.gridy++; cAdr.weightx = 0; if (getMode() == Mode.MODIFICATION) { panelAdrSpec.add(new JLabel(getLabelFor("ID_ADRESSE")), cAdr); } cAdr.gridx++; cAdr.gridwidth = GridBagConstraints.REMAINDER; this.addView("ID_ADRESSE"); compAdr = (DefaultElementSQLObject) this.getView("ID_ADRESSE").getComp(); cAdr.gridy++; if (getMode() == Mode.MODIFICATION) { panelAdrSpec.add(compAdr, cAdr); } boxAdr.addValueListener(new PropertyChangeListener() { @Override public void propertyChange(PropertyChangeEvent evt) { SQLRow row = boxAdr.getSelectedRow(); if (row != null && !row.isUndefined()) { compAdr.setCreated(true); SQLRowValues asRowValues = new SQLRowValues(row.asRowValues()); compAdr.setValue(asRowValues); } } }); c.gridy++; c.gridx = 0; c.gridwidth = GridBagConstraints.REMAINDER; c.weightx = 1; this.add(panelAdrSpec, c); c.gridwidth = 1; c.weightx = 0; boxLivrClient.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { panelAdrSpec.setVisible(boxLivrClient.isSelected()); if (!boxLivrClient.isSelected()) { boxClient.setValue((Integer) null); boxAdr.setValue((Integer) null); compAdr.setCreated(false); } } }); panelAdrSpec.setVisible(false); } } c.gridwidth = 1; // Champ Module c.gridx = 0; c.gridy++; c.gridwidth = GridBagConstraints.REMAINDER; final JPanel addP = ComptaSQLConfElement.createAdditionalPanel(); this.setAdditionalFieldsPanel(new FormLayouter(addP, 2)); this.add(addP, c); c.gridy++; c.gridwidth = 1; final ElementComboBox boxDevise = new ElementComboBox(); if (DefaultNXProps.getInstance().getBooleanValue(AbstractVenteArticleItemTable.ARTICLE_SHOW_DEVISE, false)) { // Devise c.gridx = 0; c.gridy++; c.weightx = 0; c.fill = GridBagConstraints.HORIZONTAL; this.add(new JLabel(getLabelFor("ID_DEVISE"), SwingConstants.RIGHT), c); c.gridx = GridBagConstraints.RELATIVE; c.gridwidth = 1; c.weightx = 1; c.weighty = 0; c.fill = GridBagConstraints.NONE; this.add(boxDevise, c); this.addView(boxDevise, "ID_DEVISE"); } // Reference c.gridx = 0; c.gridy++; c.gridwidth = 1; c.weightx = 0; c.fill = GridBagConstraints.HORIZONTAL; c.anchor = GridBagConstraints.EAST; this.add(new JLabel(getLabelFor("NOM"), SwingConstants.RIGHT), c); final JTextField textNom = new JTextField(); c.gridx++; c.weightx = 1; this.add(textNom, c); String field; field = "ID_COMMERCIAL"; // Commercial c.weightx = 0; c.gridx++; this.add(new JLabel(getLabelFor(field), SwingConstants.RIGHT), c); ElementComboBox commSel = new ElementComboBox(false, 25); c.gridx = GridBagConstraints.RELATIVE; c.gridwidth = 1; c.weightx = 1; c.weighty = 0; c.fill = GridBagConstraints.NONE; c.anchor = GridBagConstraints.WEST; this.add(commSel, c); addRequiredSQLObject(commSel, field); // Table d'lment c.fill = GridBagConstraints.BOTH; c.gridy++; c.gridx = 0; c.weightx = 0; c.weighty = 1; c.gridwidth = 4; this.add(this.table, c); if (DefaultNXProps.getInstance().getBooleanValue(AbstractVenteArticleItemTable.ARTICLE_SHOW_DEVISE, false)) { boxDevise.addValueListener(new PropertyChangeListener() { @Override public void propertyChange(PropertyChangeEvent evt) { table.setDevise(boxDevise.getSelectedRow()); } }); } this.fourn.addValueListener(new PropertyChangeListener() { @Override public void propertyChange(PropertyChangeEvent evt) { table.setFournisseur(fourn.getSelectedRow()); } }); // Bottom c.gridy++; c.weighty = 0; this.add(getBottomPanel(), c); c.gridx = 0; c.gridy++; c.fill = GridBagConstraints.HORIZONTAL; c.anchor = GridBagConstraints.WEST; JPanel panelOO = new JPanel(new FlowLayout(FlowLayout.RIGHT)); panelOO.add(this.checkImpression, c); panelOO.add(this.checkVisu, c); c.gridwidth = GridBagConstraints.REMAINDER; this.add(panelOO, c); addRequiredSQLObject(this.fourn, "ID_FOURNISSEUR"); addSQLObject(textNom, "NOM"); addRequiredSQLObject(dateCommande, "DATE"); // addRequiredSQLObject(radioEtat, "ID_ETAT_DEVIS"); addRequiredSQLObject(this.numeroUniqueCommande, "NUMERO"); addSQLObject(this.infos, "INFOS"); this.numeroUniqueCommande.setText(NumerotationAutoSQLElement.getNextNumero(CommandeSQLElement.class)); // radioEtat.setValue(EtatDevisSQLElement.EN_ATTENTE); // this.numeroUniqueDevis.addLabelWarningMouseListener(new MouseAdapter() { // public void mousePressed(MouseEvent e) { // // if (e.getClickCount() == 2 && e.getButton() == MouseEvent.BUTTON1) { // numeroUniqueDevis.setText(NumerotationAutoSQLElement.getNextNumeroDevis()); // } // } // }); DefaultGridBagConstraints.lockMinimumSize(this.fourn); DefaultGridBagConstraints.lockMinimumSize(commSel); }