List of usage examples for java.awt GridBagConstraints BOTH
int BOTH
To view the source code for java.awt GridBagConstraints BOTH.
Click Source Link
From source file:org.nuxeo.launcher.gui.NuxeoFrame.java
public NuxeoFrame(NuxeoLauncherGUI controller) throws HeadlessException { super("NuxeoCtl"); setController(controller);//from ww w. j a v a 2s . c o m // Main frame setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); setIconImage(appIcon.getImage()); getContentPane().setBackground(new Color(35, 37, 59)); getContentPane().setLayout(new GridBagLayout()); constraints = new GridBagConstraints(); // Header (with main button inside) constraints.fill = GridBagConstraints.HORIZONTAL; constraints.gridx = 0; constraints.anchor = GridBagConstraints.PAGE_START; JComponent header = buildHeader(); header.setPreferredSize(new Dimension(480, 110)); getContentPane().add(header, constraints); // Tabs constraints.fill = GridBagConstraints.BOTH; constraints.ipady = 100; constraints.weightx = 1.0; constraints.weighty = 1.0; getContentPane().add(buildTabbedPanel(), constraints); // Footer constraints.fill = GridBagConstraints.NONE; constraints.anchor = GridBagConstraints.PAGE_END; constraints.ipady = 0; constraints.weightx = 0; constraints.weighty = 0; constraints.insets = new Insets(10, 0, 0, 0); getContentPane().add(buildFooter(), constraints); // debug((JComponent) this.getContentPane()); }
From source file:com.sec.ose.osi.ui.frm.main.manage.dialog.JDlgProjectCreate.java
/** * This method initializes jPanelPjtName * /*from www. j ava2 s . c o m*/ * @return javax.swing.JPanel */ private JPanel getJPanelPjtName() { if (jPanelPjtName == null) { GridBagConstraints gridBagConstraints = new GridBagConstraints(); gridBagConstraints.gridx = 0; gridBagConstraints.insets = new Insets(10, 10, 0, 0); gridBagConstraints.ipadx = 4; gridBagConstraints.gridy = 0; jLabelNewProjectName = new JLabel(); jLabelNewProjectName.setText("New Project Name :"); GridBagConstraints gridBagConstraints7 = new GridBagConstraints(); gridBagConstraints7.anchor = GridBagConstraints.CENTER; gridBagConstraints7.insets = new Insets(10, 10, 10, 0); gridBagConstraints7.gridwidth = 1; gridBagConstraints7.gridx = 1; gridBagConstraints7.gridy = 1; gridBagConstraints7.weightx = 0.1; gridBagConstraints7.fill = GridBagConstraints.HORIZONTAL; GridBagConstraints gridBagConstraints6 = new GridBagConstraints(); gridBagConstraints6.anchor = GridBagConstraints.EAST; gridBagConstraints6.gridx = 0; gridBagConstraints6.gridy = 1; gridBagConstraints6.ipadx = 0; gridBagConstraints6.insets = new Insets(10, 10, 10, 0); GridBagConstraints gridBagConstraints2 = new GridBagConstraints(); gridBagConstraints2.gridx = 2; gridBagConstraints2.insets = new Insets(10, 10, 0, 10); gridBagConstraints2.fill = GridBagConstraints.NONE; gridBagConstraints2.gridy = 0; GridBagConstraints gridBagConstraints1 = new GridBagConstraints(); gridBagConstraints1.fill = GridBagConstraints.BOTH; gridBagConstraints1.gridy = 0; gridBagConstraints1.weightx = 0.1; gridBagConstraints1.gridwidth = 1; gridBagConstraints1.insets = new Insets(10, 10, 0, 0); gridBagConstraints1.gridx = 1; jPanelPjtName = new JPanel(); jPanelPjtName.setLayout(new GridBagLayout()); jPanelPjtName.setPreferredSize(new Dimension(500, 200)); jPanelPjtName.setBorder(BorderFactory.createTitledBorder(null, "Project Name", TitledBorder.DEFAULT_JUSTIFICATION, TitledBorder.DEFAULT_POSITION, new Font("Dialog", Font.BOLD, 12), new Color(51, 51, 51))); jPanelPjtName.add(getJTextFieldNewProjectName(), gridBagConstraints1); jPanelPjtName.add(getJButtonCheck(), gridBagConstraints2); jPanelPjtName.add(getJCheckBoxClonedFrom(), gridBagConstraints6); jPanelPjtName.add(getJComboBoxClonedFrom(), gridBagConstraints7); jPanelPjtName.add(jLabelNewProjectName, gridBagConstraints); } return jPanelPjtName; }
From source file:de.codesourcery.threadwatcher.ui.StatisticsPanel.java
public StatisticsPanel(FileReader reader) { this.reader = reader; table.setDefaultRenderer(TableEntry.class, new CellRenderer()); table.addMouseMotionListener(mouseListener); table.setBackground(Color.WHITE); table.setFillsViewportHeight(true);/*from www. j a va2 s.c o m*/ setLayout(new GridBagLayout()); GridBagConstraints cnstrs = new GridBagConstraints(); cnstrs.gridheight = GridBagConstraints.REMAINDER; cnstrs.gridwidth = GridBagConstraints.REMAINDER; cnstrs.fill = GridBagConstraints.BOTH; cnstrs.weightx = 1.0; cnstrs.weighty = 1.0; JScrollPane pane = new JScrollPane(table); pane.setBackground(Color.WHITE); add(pane, cnstrs); }
From source file:jatools.component.chart.customizer.Tabs.java
protected final void initializeCustomizer(int type) { GridBagLayout gbl = new GridBagLayout(); setLayout(gbl);/* w w w. j a v a 2s . co m*/ GridBagConstraints gbc = new GridBagConstraints(); gbc.insets = CommonFinal.INSETS; gbc.fill = GridBagConstraints.BOTH; tp = new JTabbedPane(); gbc.weightx = 1; gbc.weighty = 1; dataPanel = new DataSelector(); initDataPanel(); dataPanel.addChangeListener(this); dataPanel.setPrompt(dataPrompts[type]); dataPanel.setType(type); tp.add(dataPanel, ""); initTabbed(); add(tp, gbc); }
From source file:org.gridchem.client.gui.panels.myccg.resource.HPCChartPanel.java
private void init() { removeAll();//from ww w.j ava2s .c om chartPanel = createChartPanel(); setLayout(new GridBagLayout()); GridBagConstraints c = new GridBagConstraints(); c.weightx = 1.0; c.weighty = 1.0; c.gridx = 0; c.gridy = 0; c.fill = GridBagConstraints.BOTH; add(chartPanel, c); c.weightx = 0; c.weighty = 0; c.gridx = 0; c.gridy = 1; add(navPanel, c); revalidate(); }
From source file:net.sf.mzmine.modules.peaklistmethods.peakpicking.adap3decompositionV1_5.ADAP3DecompositionV1_5SetupDialog.java
@Override public void actionPerformed(ActionEvent e) { super.actionPerformed(e); final Object source = e.getSource(); if (source.equals(preview)) { if (preview.isSelected()) { // Set the height of the preview to 200 cells, so it will span // the whole vertical length of the dialog (buttons are at row // no 100). Also, we set the weight to 10, so the preview // component will consume most of the extra available space. mainPanel.add(pnlTabs, 3, 0, 1, 200, 10, 10, GridBagConstraints.BOTH); pnlVisible.add(pnlLabelsFields, BorderLayout.CENTER); comboPeakList.setSelectedIndex(0); } else {/* ww w.j a va2 s . c o m*/ mainPanel.remove(pnlTabs); pnlVisible.remove(pnlLabelsFields); } updateMinimumSize(); pack(); setLocationRelativeTo(MZmineCore.getDesktop().getMainWindow()); } else if (source.equals(comboPeakList)) { // ------------------------- // Retrieve current PeakList // ------------------------- final PeakList peakList = (PeakList) comboPeakList.getSelectedItem(); final List<Peak> peaks = ADAP3DecompositionV1_5Task.getPeaks(peakList, parameterSet.getParameter(ADAP3DecompositionV1_5Parameters.EDGE_TO_HEIGHT_RATIO).getValue(), parameterSet.getParameter(ADAP3DecompositionV1_5Parameters.DELTA_TO_HEIGHT_RATIO).getValue()); // --------------------------------- // Calculate retention time clusters // --------------------------------- List<Double> retTimeValues = new ArrayList<>(); List<Double> mzValues = new ArrayList<>(); List<Double> colorValues = new ArrayList<>(); retTimeCluster(peaks, retTimeValues, mzValues, colorValues); final int size = retTimeValues.size(); retTimeMZPlot.updateData(ArrayUtils.toPrimitive(retTimeValues.toArray(new Double[size])), ArrayUtils.toPrimitive(mzValues.toArray(new Double[size])), ArrayUtils.toPrimitive(colorValues.toArray(new Double[size]))); // ------------------------ // Calculate shape clusters // ------------------------ final ComboClustersItem item = (ComboClustersItem) comboClusters.getSelectedItem(); if (item != null) { final List<List<NavigableMap<Double, Double>>> shapeClusters = new ArrayList<>(); final List<List<String>> texts = new ArrayList<>(); final List<Double> colors = new ArrayList<>(); shapeCluster(item.cluster, shapeClusters, texts, colors); retTimeIntensityPlot.updateData(shapeClusters, colors, texts, null); } } else if (source.equals(comboClusters)) { // ------------------------ // Calculate shape clusters // ------------------------ final ComboClustersItem item = (ComboClustersItem) comboClusters.getSelectedItem(); if (item != null) { final List<List<NavigableMap<Double, Double>>> shapeClusters = new ArrayList<>(); final List<List<String>> texts = new ArrayList<>(); final List<Double> colors = new ArrayList<>(); shapeCluster(item.cluster, shapeClusters, texts, colors); retTimeIntensityPlot.updateData(shapeClusters, colors, texts, null); } } }
From source file:com.rapidminer.gui.new_plotter.gui.dialog.ManageZoomDialog.java
/** * Setup the GUI./* w ww . j a va2 s.c om*/ */ private void setupGUI() { JPanel mainPanel = new JPanel(); this.setContentPane(mainPanel); // start layout mainPanel.setLayout(new GridBagLayout()); GridBagConstraints gbc = new GridBagConstraints(); gbc.gridx = 0; gbc.gridy = 0; gbc.fill = GridBagConstraints.HORIZONTAL; gbc.weightx = 0; gbc.anchor = GridBagConstraints.WEST; gbc.insets = new Insets(5, 5, 2, 5); JPanel radioPanel = new JPanel(); radioPanel.setLayout(new BorderLayout()); zoomRadiobutton = new JRadioButton( I18N.getMessage(I18N.getGUIBundle(), "gui.action.manage_zoom.zoom.label")); zoomRadiobutton.setToolTipText(I18N.getMessage(I18N.getGUIBundle(), "gui.action.manage_zoom.zoom.tip")); zoomRadiobutton.setSelected(true); radioPanel.add(zoomRadiobutton, BorderLayout.LINE_START); gbc.gridx = 1; gbc.gridy = 0; gbc.weightx = 1; selectionRadiobutton = new JRadioButton( I18N.getMessage(I18N.getGUIBundle(), "gui.action.manage_zoom.selection.label")); selectionRadiobutton .setToolTipText(I18N.getMessage(I18N.getGUIBundle(), "gui.action.manage_zoom.selection.tip")); selectionRadiobutton.setHorizontalAlignment(SwingConstants.CENTER); radioPanel.add(selectionRadiobutton, BorderLayout.LINE_END); gbc.gridx = 0; gbc.gridy = 0; gbc.gridwidth = 3; this.add(radioPanel, gbc); ButtonGroup group = new ButtonGroup(); group.add(zoomRadiobutton); group.add(selectionRadiobutton); gbc.gridx = 0; gbc.gridy = 1; gbc.fill = GridBagConstraints.BOTH; gbc.weightx = 1; gbc.gridwidth = 3; gbc.anchor = GridBagConstraints.CENTER; rangeAxisSelectionCombobox = new JComboBox(); rangeAxisSelectionCombobox.setToolTipText( I18N.getMessage(I18N.getGUIBundle(), "gui.action.manage_zoom.range_axis_combobox.tip")); rangeAxisSelectionCombobox.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { updateValueRange(); } }); this.add(rangeAxisSelectionCombobox, gbc); gbc.gridx = 0; gbc.gridy = 2; gbc.fill = GridBagConstraints.NONE; gbc.weightx = 1; gbc.gridwidth = 3; gbc.anchor = GridBagConstraints.WEST; gbc.insets = new Insets(5, 5, 2, 5); JLabel domainRangeLowerBoundLabel = new JLabel( I18N.getMessage(I18N.getGUIBundle(), "gui.action.manage_zoom.domain_lower_bound.label")); this.add(domainRangeLowerBoundLabel, gbc); gbc.gridx = 1; gbc.gridy = 2; gbc.insets = new Insets(2, 5, 2, 5); gbc.fill = GridBagConstraints.HORIZONTAL; domainRangeLowerBoundField = new JTextField(); domainRangeLowerBoundField.setText(String.valueOf(domainRangeLowerBound)); domainRangeLowerBoundField.setInputVerifier(new InputVerifier() { @Override public boolean verify(JComponent input) { return verifyDomainRangeLowerBoundInput(input); } }); domainRangeLowerBoundField.setToolTipText( I18N.getMessage(I18N.getGUIBundle(), "gui.action.manage_zoom.domain_lower_bound.tip")); this.add(domainRangeLowerBoundField, gbc); gbc.gridx = 0; gbc.gridy = 3; gbc.fill = GridBagConstraints.NONE; JLabel domainRangeUpperBoundLabel = new JLabel( I18N.getMessage(I18N.getGUIBundle(), "gui.action.manage_zoom.domain_upper_bound.label")); this.add(domainRangeUpperBoundLabel, gbc); gbc.gridx = 1; gbc.gridy = 3; gbc.fill = GridBagConstraints.HORIZONTAL; domainRangeUpperBoundField = new JTextField(); domainRangeUpperBoundField.setToolTipText( I18N.getMessage(I18N.getGUIBundle(), "gui.action.manage_zoom.domain_upper_bound.tip")); domainRangeUpperBoundField.setText(String.valueOf(domainRangeUpperBound)); domainRangeUpperBoundField.setInputVerifier(new InputVerifier() { @Override public boolean verify(JComponent input) { return verifyDomainRangeUpperBoundInput(input); } }); this.add(domainRangeUpperBoundField, gbc); gbc.gridx = 0; gbc.gridy = 4; gbc.fill = GridBagConstraints.NONE; JLabel valueRangeLowerBoundLabel = new JLabel( I18N.getMessage(I18N.getGUIBundle(), "gui.action.manage_zoom.value_lower_bound.label")); this.add(valueRangeLowerBoundLabel, gbc); gbc.gridx = 1; gbc.gridy = 4; gbc.fill = GridBagConstraints.HORIZONTAL; valueRangeLowerBoundField = new JTextField(); valueRangeLowerBoundField.setToolTipText( I18N.getMessage(I18N.getGUIBundle(), "gui.action.manage_zoom.value_lower_bound.tip")); valueRangeLowerBoundField.setText(String.valueOf(valueRangeLowerBound)); valueRangeLowerBoundField.setInputVerifier(new InputVerifier() { @Override public boolean verify(JComponent input) { return verifyValueRangeLowerBoundInput(input); } }); this.add(valueRangeLowerBoundField, gbc); gbc.gridx = 0; gbc.gridy = 5; gbc.fill = GridBagConstraints.NONE; JLabel valueRangeUpperBoundLabel = new JLabel( I18N.getMessage(I18N.getGUIBundle(), "gui.action.manage_zoom.value_upper_bound.label")); this.add(valueRangeUpperBoundLabel, gbc); gbc.gridx = 1; gbc.gridy = 5; gbc.fill = GridBagConstraints.HORIZONTAL; valueRangeUpperBoundField = new JTextField(); valueRangeUpperBoundField.setToolTipText( I18N.getMessage(I18N.getGUIBundle(), "gui.action.manage_zoom.value_upper_bound.tip")); valueRangeUpperBoundField.setText(String.valueOf(valueRangeUpperBound)); valueRangeUpperBoundField.setInputVerifier(new InputVerifier() { @Override public boolean verify(JComponent input) { return verifyValueRangeUpperBoundInput(input); } }); this.add(valueRangeUpperBoundField, gbc); gbc.gridx = 0; gbc.gridy = 6; gbc.gridwidth = 3; gbc.fill = GridBagConstraints.HORIZONTAL; gbc.anchor = GridBagConstraints.CENTER; this.add(new JSeparator(), gbc); gbc.gridx = 0; gbc.gridy = 7; gbc.fill = GridBagConstraints.NONE; gbc.anchor = GridBagConstraints.WEST; JLabel colorMinValueLabel = new JLabel( I18N.getMessage(I18N.getGUIBundle(), "gui.action.manage_zoom.color_min_value.label")); this.add(colorMinValueLabel, gbc); gbc.gridx = 1; gbc.gridy = 7; gbc.fill = GridBagConstraints.HORIZONTAL; colorMinValueField = new JTextField(); colorMinValueField .setToolTipText(I18N.getMessage(I18N.getGUIBundle(), "gui.action.manage_zoom.color_min_value.tip")); colorMinValueField.setText(String.valueOf(colorMinValue)); colorMinValueField.setInputVerifier(new InputVerifier() { @Override public boolean verify(JComponent input) { return verifyColorInput(input); } }); colorMinValueField.setEnabled(false); this.add(colorMinValueField, gbc); gbc.gridx = 0; gbc.gridy = 8; gbc.fill = GridBagConstraints.NONE; JLabel colorMaxValueLabel = new JLabel( I18N.getMessage(I18N.getGUIBundle(), "gui.action.manage_zoom.color_max_value.label")); this.add(colorMaxValueLabel, gbc); gbc.gridx = 1; gbc.gridy = 8; gbc.fill = GridBagConstraints.HORIZONTAL; colorMaxValueField = new JTextField(); colorMaxValueField .setToolTipText(I18N.getMessage(I18N.getGUIBundle(), "gui.action.manage_zoom.color_max_value.tip")); colorMaxValueField.setText(String.valueOf(colorMaxValue)); colorMaxValueField.setInputVerifier(new InputVerifier() { @Override public boolean verify(JComponent input) { return verifyColorInput(input); } }); colorMaxValueField.setEnabled(false); this.add(colorMaxValueField, gbc); gbc.gridx = 1; gbc.gridy = 9; gbc.fill = GridBagConstraints.NONE; restoreColorButton = new JButton( I18N.getMessage(I18N.getGUIBundle(), "gui.action.manage_zoom.restore_color.label")); restoreColorButton .setToolTipText(I18N.getMessage(I18N.getGUIBundle(), "gui.action.manage_zoom.restore_color.tip")); restoreColorButton.setIcon(SwingTools.createIcon( "16/" + I18N.getMessage(I18N.getGUIBundle(), "gui.action.manage_zoom.restore_color.icon"))); restoreColorButton.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { LinkAndBrushSelection linkAndBrushSelection = new LinkAndBrushSelection(SelectionType.RESTORE_COLOR, new LinkedList<Pair<Integer, Range>>(), new LinkedList<Pair<Integer, Range>>(), null, null, engine.getPlotInstance()); engine.getChartPanel().informLinkAndBrushSelectionListeners(linkAndBrushSelection); updateColorValues(); } }); restoreColorButton.setEnabled(false); this.add(restoreColorButton, gbc); gbc.gridx = 0; gbc.gridy = 10; gbc.gridwidth = 3; gbc.fill = GridBagConstraints.HORIZONTAL; gbc.anchor = GridBagConstraints.CENTER; gbc.insets = new Insets(2, 5, 5, 5); this.add(new JSeparator(), gbc); gbc.gridx = 0; gbc.gridy = 11; gbc.gridwidth = 1; gbc.fill = GridBagConstraints.NONE; gbc.anchor = GridBagConstraints.WEST; gbc.insets = new Insets(5, 5, 5, 5); okButton = new JButton(I18N.getMessage(I18N.getGUIBundle(), "gui.action.manage_zoom.ok.label")); okButton.setToolTipText(I18N.getMessage(I18N.getGUIBundle(), "gui.action.manage_zoom.ok.tip")); okButton.setIcon(SwingTools .createIcon("24/" + I18N.getMessage(I18N.getGUIBundle(), "gui.action.manage_zoom.ok.icon"))); okButton.setMnemonic( I18N.getMessage(I18N.getGUIBundle(), "gui.action.manage_zoom.ok.mne").toCharArray()[0]); okButton.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { // make sure fields have correct values boolean fieldsPassedChecks = checkFields(); if (!fieldsPassedChecks) { return; } Object selectedItem = rangeAxisSelectionCombobox.getSelectedItem(); if (selectedItem != null && selectedItem instanceof RangeAxisConfig) { RangeAxisConfig config = (RangeAxisConfig) selectedItem; boolean zoomOnLinkAndBrushSelection = engine.getChartPanel().getZoomOnLinkAndBrushSelection(); Range domainRange = new Range(Double.parseDouble(domainRangeLowerBoundField.getText()), Double.parseDouble(domainRangeUpperBoundField.getText())); Range valueRange = new Range(Double.parseDouble(valueRangeLowerBoundField.getText()), Double.parseDouble(valueRangeUpperBoundField.getText())); LinkedList<Pair<Integer, Range>> domainRangeList = new LinkedList<Pair<Integer, Range>>(); // only add domain zoom if != 0 if (domainRange.getUpperBound() != 0) { domainRangeList.add(new Pair<Integer, Range>(0, domainRange)); } LinkedList<Pair<Integer, Range>> valueRangeList = new LinkedList<Pair<Integer, Range>>(); // only add range zoom if at least one RangeAxisConfig exists if (engine.getPlotInstance().getMasterPlotConfiguration().getRangeAxisConfigs().size() > 0) { if (valueRange.getUpperBound() != 0) { // only add value zoom if != 0 valueRangeList.add( new Pair<Integer, Range>(engine.getPlotInstance().getMasterPlotConfiguration() .getIndexOfRangeAxisConfigById(config.getId()), valueRange)); } } // zoom or select or color LinkAndBrushSelection linkAndBrushSelection = null; if (zoomRadiobutton.isSelected()) { linkAndBrushSelection = new LinkAndBrushSelection(SelectionType.ZOOM_IN, domainRangeList, valueRangeList); if (isColorChanged(Double.parseDouble(colorMinValueField.getText()), Double.parseDouble(colorMaxValueField.getText()))) { linkAndBrushSelection = new LinkAndBrushSelection(SelectionType.COLOR_ZOOM, domainRangeList, valueRangeList, Double.parseDouble(colorMinValueField.getText()), Double.parseDouble(colorMaxValueField.getText()), engine.getPlotInstance()); } } else if (selectionRadiobutton.isSelected()) { linkAndBrushSelection = new LinkAndBrushSelection(SelectionType.SELECTION, domainRangeList, valueRangeList); if (isColorChanged(Double.parseDouble(colorMinValueField.getText()), Double.parseDouble(colorMaxValueField.getText()))) { linkAndBrushSelection = new LinkAndBrushSelection(SelectionType.COLOR_SELECTION, domainRangeList, valueRangeList, Double.parseDouble(colorMinValueField.getText()), Double.parseDouble(colorMaxValueField.getText()), engine.getPlotInstance()); } } engine.getChartPanel().informLinkAndBrushSelectionListeners(linkAndBrushSelection); engine.getChartPanel().setZoomOnLinkAndBrushSelection(zoomOnLinkAndBrushSelection); } else { return; } ManageZoomDialog.this.dispose(); } }); okButton.addKeyListener(new KeyAdapter() { @Override public void keyPressed(KeyEvent e) { if (e.getKeyCode() == KeyEvent.VK_ENTER) { okButton.doClick(); } } }); this.add(okButton, gbc); gbc.gridx = 2; gbc.gridy = 11; gbc.fill = GridBagConstraints.NONE; gbc.anchor = GridBagConstraints.EAST; cancelButton = new JButton(I18N.getMessage(I18N.getGUIBundle(), "gui.action.manage_zoom.cancel.label")); cancelButton.setToolTipText(I18N.getMessage(I18N.getGUIBundle(), "gui.action.manage_zoom.cancel.tip")); cancelButton.setIcon(SwingTools .createIcon("24/" + I18N.getMessage(I18N.getGUIBundle(), "gui.action.manage_zoom.cancel.icon"))); cancelButton.setMnemonic( I18N.getMessage(I18N.getGUIBundle(), "gui.action.manage_zoom.cancel.mne").toCharArray()[0]); cancelButton.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { // cancel requested, close dialog ManageZoomDialog.this.dispose(); } }); this.add(cancelButton, gbc); // misc settings this.setMinimumSize(new Dimension(375, 360)); // center dialog this.setLocationRelativeTo(null); this.setTitle(I18N.getMessage(I18N.getGUIBundle(), "gui.action.manage_zoom.title.label")); this.setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE); this.setModal(true); this.addWindowListener(new WindowAdapter() { @Override public void windowActivated(WindowEvent e) { okButton.requestFocusInWindow(); } }); }
From source file:SplineAnim.java
private void createControlPanel(Panel p) { GridBagLayout gl = new GridBagLayout(); GridBagConstraints gbc = new GridBagConstraints(); p.setLayout(gl);// w w w. ja va2 s .co m gbc.weightx = 100; gbc.weighty = 100; gbc.fill = GridBagConstraints.BOTH; gbc.gridx = 0; gbc.gridy = 0; gbc.gridwidth = 1; gbc.gridheight = 1; interpLabel = new Label("Interpolation Type", Label.LEFT); p.add(interpLabel, gbc); gbc.gridx = 1; gbc.gridy = 0; gbc.gridwidth = 1; gbc.gridheight = 1; interpChoice = new Choice(); interpChoice.add("Spline"); interpChoice.add("Linear"); p.add(interpChoice, gbc); interpChoice.addItemListener(this); gbc.gridx = 0; gbc.gridy = 2; gbc.gridwidth = 2; gbc.gridheight = 1; speedSlider = new Scrollbar(Scrollbar.HORIZONTAL, 2, 1, 0, 11); speedSlider.setUnitIncrement(1); p.add(speedSlider, gbc); speedSlider.addAdjustmentListener(this); gbc.gridx = 0; gbc.gridy = 3; gbc.gridwidth = 2; gbc.gridheight = 1; speedLabel = new Label(" - Animation Speed +", Label.CENTER); p.add(speedLabel, gbc); gbc.gridx = 0; gbc.gridy = 5; gbc.gridwidth = 2; gbc.gridheight = 1; animateButton = new Button("Stop Animation"); p.add(animateButton, gbc); animateButton.addActionListener(this); }
From source file:org.eurocarbdb.application.glycoworkbench.plugin.s3.gui.SignedGetUrlDialog.java
public SignedGetUrlDialog(Frame ownerFrame, HyperlinkActivatedListener hyperlinkListener, S3Service s3Service, S3Object[] objects) {//from w w w . j a v a 2 s .c om super(ownerFrame, "Generate Signed GET URLs", true); this.ownerFrame = ownerFrame; this.hyperlinkListener = hyperlinkListener; this.s3Service = s3Service; this.objects = objects; String introductionText = "<html><center>Generate signed GET URLs that you can provide to anyone<br>" + "who needs to access objects in your bucket for a limited time.</center></html>"; JHtmlLabel introductionLabel = new JHtmlLabel(introductionText, hyperlinkListener); introductionLabel.setHorizontalAlignment(JLabel.CENTER); JHtmlLabel expiryTimeLabel = new JHtmlLabel("<html><b>Expiry Time</b> (Hours)</html>", hyperlinkListener); expiryTimeLabel.setHorizontalAlignment(JLabel.RIGHT); JHtmlLabel httpsUrlsLabel = new JHtmlLabel("<html><b>Secure HTTPS URLs?</b></html>", hyperlinkListener); httpsUrlsLabel.setHorizontalAlignment(JLabel.RIGHT); JHtmlLabel virtualHostLabel = new JHtmlLabel("<html><b>Bucket is a Virtual Host?</b></html>", hyperlinkListener); virtualHostLabel.setHorizontalAlignment(JLabel.RIGHT); JHtmlLabel requesterPaysLabel = new JHtmlLabel("<html><b>Bucket is Requester Pays?</b></html>", hyperlinkListener); requesterPaysLabel.setHorizontalAlignment(JLabel.RIGHT); expiryTimeTextField = new JTextField("1.0"); expiryTimeTextField.setToolTipText("How long in hours until the URL will expire"); expiryTimeTextField.getDocument().addDocumentListener(this); httpsUrlsCheckBox = new JCheckBox(); httpsUrlsCheckBox.setSelected(false); httpsUrlsCheckBox.setToolTipText("Check this box to generate secure HTTPS URLs."); httpsUrlsCheckBox.addActionListener(this); virtualHostCheckBox = new JCheckBox(); virtualHostCheckBox.setSelected(false); virtualHostCheckBox.setToolTipText("Check this box if your bucket is configured as a virtual host."); virtualHostCheckBox.addActionListener(this); requesterPaysCheckBox = new JCheckBox(); requesterPaysCheckBox.setSelected(false); requesterPaysCheckBox.setToolTipText("Check this box if the bucket has Requester Pays enabled."); requesterPaysCheckBox.addActionListener(this); finishedButton = new JButton("Finished"); finishedButton.setActionCommand("Finished"); finishedButton.addActionListener(this); signedUrlsTextArea = new JTextArea(); signedUrlsTextArea.setEditable(false); // Set default ENTER and ESCAPE buttons. this.getRootPane().setDefaultButton(finishedButton); 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 = -6225706489569112809L; public void actionPerformed(ActionEvent actionEvent) { setVisible(false); } }); JPanel panel = new JPanel(new GridBagLayout()); int row = 0; panel.add(introductionLabel, new GridBagConstraints(0, row, 6, 1, 0, 0, GridBagConstraints.CENTER, GridBagConstraints.HORIZONTAL, insetsDefault, 0, 0)); panel.add(expiryTimeLabel, new GridBagConstraints(0, ++row, 1, 1, 0, 0, GridBagConstraints.EAST, GridBagConstraints.HORIZONTAL, insetsDefault, 0, 0)); panel.add(expiryTimeTextField, new GridBagConstraints(1, row, 5, 1, 1, 0, GridBagConstraints.WEST, GridBagConstraints.HORIZONTAL, insetsDefault, 0, 0)); panel.add(httpsUrlsLabel, new GridBagConstraints(0, ++row, 1, 1, 0.3, 0, GridBagConstraints.EAST, GridBagConstraints.HORIZONTAL, insetsDefault, 0, 0)); panel.add(httpsUrlsCheckBox, new GridBagConstraints(1, row, 1, 1, 0, 0, GridBagConstraints.WEST, GridBagConstraints.NONE, insetsDefault, 0, 0)); panel.add(virtualHostLabel, new GridBagConstraints(2, row, 1, 1, 0.3, 0, GridBagConstraints.EAST, GridBagConstraints.HORIZONTAL, insetsDefault, 0, 0)); panel.add(virtualHostCheckBox, new GridBagConstraints(3, row, 1, 1, 0, 0, GridBagConstraints.WEST, GridBagConstraints.NONE, insetsDefault, 0, 0)); panel.add(requesterPaysLabel, new GridBagConstraints(4, row, 1, 1, 0.3, 0, GridBagConstraints.EAST, GridBagConstraints.HORIZONTAL, insetsDefault, 0, 0)); panel.add(requesterPaysCheckBox, new GridBagConstraints(5, row, 1, 1, 0, 0, GridBagConstraints.WEST, GridBagConstraints.NONE, insetsDefault, 0, 0)); panel.add(new JScrollPane(signedUrlsTextArea), new GridBagConstraints(0, ++row, 6, 1, 1, 1, GridBagConstraints.CENTER, GridBagConstraints.BOTH, insetsDefault, 0, 0)); panel.add(finishedButton, new GridBagConstraints(0, ++row, 6, 1, 0, 0, GridBagConstraints.CENTER, GridBagConstraints.NONE, insetsDefault, 0, 0)); this.getContentPane().setLayout(new GridBagLayout()); this.getContentPane().add(panel, new GridBagConstraints(0, 0, 1, 1, 1, 1, GridBagConstraints.CENTER, GridBagConstraints.BOTH, insetsDefault, 0, 0)); this.setSize(700, 450); this.setResizable(true); this.setLocationRelativeTo(ownerFrame); generateSignedUrls(); }
From source file:org.openconcerto.erp.core.supplychain.receipt.component.BonReceptionSQLComponent.java
public void addViews() { this.setLayout(new GridBagLayout()); final GridBagConstraints c = new DefaultGridBagConstraints(); // Champ Module c.gridx = 0;//from w w w .j a va2 s .c om c.gridy++; c.gridwidth = GridBagConstraints.REMAINDER; final JPanel addP = ComptaSQLConfElement.createAdditionalPanel(); this.setAdditionalFieldsPanel(new FormLayouter(addP, 1)); this.add(addP, c); c.gridy++; c.gridwidth = 1; this.textTotalHT.setOpaque(false); this.textTotalTVA.setOpaque(false); this.textTotalTTC.setOpaque(false); this.selectCommande = new ElementComboBox(); // Numero JLabel labelNum = new JLabel(getLabelFor("NUMERO")); labelNum.setHorizontalAlignment(SwingConstants.RIGHT); this.add(labelNum, c); this.textNumeroUnique = new JUniqueTextField(16); c.gridx++; c.weightx = 1; c.weighty = 0; c.fill = GridBagConstraints.NONE; DefaultGridBagConstraints.lockMinimumSize(this.textNumeroUnique); this.add(this.textNumeroUnique, c); // Date JLabel labelDate = new JLabel(getLabelFor("DATE")); labelDate.setHorizontalAlignment(SwingConstants.RIGHT); c.fill = GridBagConstraints.HORIZONTAL; c.gridx++; c.weightx = 0; this.add(labelDate, c); JDate date = new JDate(true); c.gridx++; c.weightx = 0; c.weighty = 0; this.add(date, c); // Reference c.gridy++; c.gridx = 0; final JLabel labelNom = new JLabel(getLabelFor("NOM")); labelNom.setHorizontalAlignment(SwingConstants.RIGHT); this.add(labelNom, c); c.gridx++; c.fill = GridBagConstraints.HORIZONTAL; DefaultGridBagConstraints.lockMinimumSize(this.textReference); this.add(this.textReference, c); // Fournisseur JLabel labelFournisseur = new JLabel(getLabelFor("ID_FOURNISSEUR")); labelFournisseur.setHorizontalAlignment(SwingConstants.RIGHT); c.gridx = 0; c.gridy++; c.weightx = 0; c.weighty = 0; this.add(labelFournisseur, c); this.fournisseur = new ElementComboBox(); c.gridx++; c.weightx = 0; c.weighty = 0; c.fill = GridBagConstraints.NONE; this.add(this.fournisseur, c); // Devise c.gridx = 0; c.gridy++; c.weightx = 0; c.fill = GridBagConstraints.HORIZONTAL; this.add(new JLabel(getLabelFor("ID_DEVISE"), SwingConstants.RIGHT), c); final ElementComboBox boxDevise = new ElementComboBox(); 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"); // Element du bon this.tableBonItem = new BonReceptionItemTable(); c.gridx = 0; c.gridy++; c.weightx = 1; c.weighty = 1; c.gridwidth = GridBagConstraints.REMAINDER; c.fill = GridBagConstraints.BOTH; this.add(this.tableBonItem, c); this.fournisseur.addValueListener(new PropertyChangeListener() { @Override public void propertyChange(PropertyChangeEvent evt) { tableBonItem.setFournisseur(fournisseur.getSelectedRow()); } }); c.anchor = GridBagConstraints.EAST; // Totaux reconfigure(this.textTotalHT); reconfigure(this.textTotalTVA); reconfigure(this.textTotalTTC); // Poids Total c.gridy++; c.gridx = 1; c.weightx = 0; c.weighty = 0; c.anchor = GridBagConstraints.EAST; c.gridwidth = 1; c.fill = GridBagConstraints.NONE; DefaultProps props = DefaultNXProps.getInstance(); Boolean b = props.getBooleanValue("ArticleShowPoids"); if (b) { JPanel panelPoids = new JPanel(new GridBagLayout()); GridBagConstraints c2 = new DefaultGridBagConstraints(); c2.fill = GridBagConstraints.NONE; panelPoids.add(new JLabel(getLabelFor("TOTAL_POIDS")), c2); // Necessaire pour ne pas avoir de saut de layout DefaultGridBagConstraints.lockMinimumSize(this.textPoidsTotal); this.textPoidsTotal.setEnabled(false); this.textPoidsTotal.setHorizontalAlignment(JTextField.RIGHT); this.textPoidsTotal.setDisabledTextColor(Color.BLACK); c2.gridx++; c2.weightx = 1; c2.fill = GridBagConstraints.HORIZONTAL; panelPoids.add(this.textPoidsTotal, c2); this.add(panelPoids, c); } c.gridx = 2; c.gridwidth = GridBagConstraints.REMAINDER; c.weightx = 0; c.weighty = 0; c.anchor = GridBagConstraints.EAST; c.fill = GridBagConstraints.HORIZONTAL; final GridBagConstraints cTotalPan = new DefaultGridBagConstraints(); JPanel panelTotalHT = new JPanel(); panelTotalHT.setLayout(new GridBagLayout()); cTotalPan.gridx = 0; cTotalPan.weightx = 0; cTotalPan.fill = GridBagConstraints.HORIZONTAL; cTotalPan.anchor = GridBagConstraints.WEST; final JLabelBold labelTotalHT = new JLabelBold(getLabelFor("TOTAL_HT")); panelTotalHT.add(labelTotalHT, cTotalPan); cTotalPan.anchor = GridBagConstraints.EAST; cTotalPan.gridx++; cTotalPan.weightx = 1; this.textTotalHT.setFont(labelTotalHT.getFont()); DefaultGridBagConstraints.lockMinimumSize(this.textTotalHT); panelTotalHT.add(this.textTotalHT, cTotalPan); this.add(panelTotalHT, c); JPanel panelTotalTVA = new JPanel(); panelTotalTVA.setLayout(new GridBagLayout()); cTotalPan.gridx = 0; cTotalPan.weightx = 0; cTotalPan.anchor = GridBagConstraints.WEST; cTotalPan.fill = GridBagConstraints.HORIZONTAL; panelTotalTVA.add(new JLabelBold(getLabelFor("TOTAL_TVA")), cTotalPan); cTotalPan.anchor = GridBagConstraints.EAST; cTotalPan.gridx++; cTotalPan.weightx = 1; DefaultGridBagConstraints.lockMinimumSize(this.textTotalTVA); panelTotalTVA.add(this.textTotalTVA, cTotalPan); c.gridy++; c.fill = GridBagConstraints.HORIZONTAL; this.add(panelTotalTVA, c); JPanel panelTotalTTC = new JPanel(); panelTotalTTC.setLayout(new GridBagLayout()); cTotalPan.gridx = 0; cTotalPan.anchor = GridBagConstraints.WEST; cTotalPan.gridwidth = GridBagConstraints.REMAINDER; cTotalPan.fill = GridBagConstraints.BOTH; cTotalPan.weightx = 1; panelTotalTTC.add(new JSeparator(), cTotalPan); cTotalPan.gridwidth = 1; cTotalPan.fill = GridBagConstraints.NONE; cTotalPan.weightx = 0; cTotalPan.gridy++; panelTotalTTC.add(new JLabelBold(getLabelFor("TOTAL_TTC")), cTotalPan); cTotalPan.anchor = GridBagConstraints.EAST; cTotalPan.gridx++; this.textTotalTTC.setFont(labelTotalHT.getFont()); DefaultGridBagConstraints.lockMinimumSize(this.textTotalTTC); panelTotalTTC.add(this.textTotalTTC, cTotalPan); c.gridy++; // probleme de tremblement vertical this.add(panelTotalTTC, c); c.anchor = GridBagConstraints.WEST; /******************************************************************************************* * * INFORMATIONS COMPLEMENTAIRES ******************************************************************************************/ c.gridwidth = GridBagConstraints.REMAINDER; c.weightx = 1; c.fill = GridBagConstraints.HORIZONTAL; c.gridx = 0; c.gridy++; TitledSeparator sep = new TitledSeparator("Informations complmentaires"); c.insets = new Insets(10, 2, 1, 2); this.add(sep, c); c.insets = new Insets(2, 2, 1, 2); c.gridx = 0; c.gridy++; c.gridheight = 1; c.gridwidth = GridBagConstraints.REMAINDER; c.weightx = 1; c.weighty = 0; c.fill = GridBagConstraints.BOTH; final ITextArea textInfos = new ITextArea(4, 4); JScrollPane scrollPane = new JScrollPane(textInfos); DefaultGridBagConstraints.lockMinimumSize(scrollPane); this.add(textInfos, c); this.addRequiredSQLObject(date, "DATE"); this.addSQLObject(textInfos, "INFOS"); this.addSQLObject(this.textReference, "NOM"); this.addSQLObject(this.selectCommande, "ID_COMMANDE"); this.addRequiredSQLObject(this.textNumeroUnique, "NUMERO"); this.addSQLObject(this.textPoidsTotal, "TOTAL_POIDS"); this.addRequiredSQLObject(this.textTotalHT, "TOTAL_HT"); this.addRequiredSQLObject(this.textTotalTVA, "TOTAL_TVA"); this.addRequiredSQLObject(this.textTotalTTC, "TOTAL_TTC"); this.addRequiredSQLObject(this.fournisseur, "ID_FOURNISSEUR"); this.textNumeroUnique.setText(NumerotationAutoSQLElement.getNextNumero(BonReceptionSQLElement.class)); // Listeners this.tableBonItem.getModel().addTableModelListener(new TableModelListener() { public void tableChanged(TableModelEvent e) { int columnIndexHT = BonReceptionSQLComponent.this.tableBonItem.getModel().getColumnIndexForElement( BonReceptionSQLComponent.this.tableBonItem.getPrixTotalHTElement()); int columnIndexTTC = BonReceptionSQLComponent.this.tableBonItem.getModel().getColumnIndexForElement( BonReceptionSQLComponent.this.tableBonItem.getPrixTotalTTCElement()); int columnIndexPoids = BonReceptionSQLComponent.this.tableBonItem.getModel() .getColumnIndexForElement( BonReceptionSQLComponent.this.tableBonItem.getPoidsTotalElement()); if (e.getColumn() == TableModelEvent.ALL_COLUMNS || e.getColumn() == columnIndexHT || e.getColumn() == columnIndexTTC) { updateTotal(); } if (e.getColumn() == TableModelEvent.ALL_COLUMNS || e.getColumn() == columnIndexPoids) { BonReceptionSQLComponent.this.textPoidsTotal.setText(String .valueOf(Math.round(BonReceptionSQLComponent.this.tableBonItem.getPoidsTotal() * 1000) / 1000.0)); } } }); // Lock UI DefaultGridBagConstraints.lockMinimumSize(this.fournisseur); }