List of usage examples for java.awt GridBagLayout GridBagLayout
public GridBagLayout()
From source file:com.moss.appprocs.swing.ProgressMonitorPanel.java
/** * @param useScrollpane If true, the panel which holds the ProgressMonitorBeanS will be embedded in a JSrollPane *//*from w w w.j a v a 2 s .c om*/ public ProgressMonitorPanel(boolean useScrollpane) { if (useScrollpane) { JScrollPane scrollpane = new JScrollPane(); setLayout(new BorderLayout()); add(scrollpane, BorderLayout.CENTER); scrollpane.setViewportView(monitorsPanel); monitorsPanel.setLayout(new GridBagLayout()); } else { setLayout(new BorderLayout()); add(monitorsPanel, BorderLayout.CENTER); monitorsPanel.setLayout(new GridBagLayout()); } }
From source file:com.digitalgeneralists.assurance.ui.components.SettingsPanel.java
@Override protected void initializeComponent() { if (!this.initialized) { this.dialogTitle = Application.applicationShortName + " Settings"; // NOTE: There is no notion of add-mode in this dialog. There should // always be a single instance of the application configuration. if (this.configuration == null) { this.configuration = ApplicationConfiguration.createDefaultConfiguration(); }//www. j ava 2s. c o m this.mode = AssuranceDialogMode.EDIT; GridBagLayout gridbag = new GridBagLayout(); this.setLayout(gridbag); final JPanel scanSettingsPanel = new JPanel(); scanSettingsPanel.setLayout(new GridBagLayout()); Border scanSettingsPanelBorder = BorderFactory.createEtchedBorder(EtchedBorder.LOWERED); scanSettingsPanelBorder = BorderFactory.createTitledBorder(scanSettingsPanelBorder, "Scan Settings", TitledBorder.CENTER, TitledBorder.TOP); GridBagConstraints scanSettingsPanelConstraints = new GridBagConstraints(); scanSettingsPanelConstraints.anchor = GridBagConstraints.NORTH; scanSettingsPanelConstraints.fill = GridBagConstraints.HORIZONTAL; scanSettingsPanelConstraints.gridx = 0; scanSettingsPanelConstraints.gridy = 0; scanSettingsPanelConstraints.weightx = 1.0; scanSettingsPanelConstraints.weighty = 1.0; scanSettingsPanelConstraints.gridheight = 1; scanSettingsPanelConstraints.gridwidth = 2; scanSettingsPanelConstraints.insets = new Insets(5, 5, 5, 5); scanSettingsPanel.setBorder(scanSettingsPanelBorder); this.add(scanSettingsPanel, scanSettingsPanelConstraints); GridBagConstraints ignoredFileNamesLabelConstraints = new GridBagConstraints(); ignoredFileNamesLabelConstraints.anchor = GridBagConstraints.NORTHWEST; ignoredFileNamesLabelConstraints.fill = GridBagConstraints.NONE; ignoredFileNamesLabelConstraints.gridx = 0; ignoredFileNamesLabelConstraints.gridy = 0; ignoredFileNamesLabelConstraints.weightx = 1.0; ignoredFileNamesLabelConstraints.weighty = 1.0; ignoredFileNamesLabelConstraints.gridheight = 1; ignoredFileNamesLabelConstraints.gridwidth = 1; ignoredFileNamesLabelConstraints.insets = new Insets(5, 10, 0, 5); final JLabel ignoredFileNamesLabel = new JLabel("Ignored Files", SwingConstants.LEFT); scanSettingsPanel.add(ignoredFileNamesLabel, ignoredFileNamesLabelConstraints); GridBagConstraints ignoredFileNamesTextFieldConstraints = new GridBagConstraints(); ignoredFileNamesTextFieldConstraints.anchor = GridBagConstraints.NORTH; ignoredFileNamesTextFieldConstraints.fill = GridBagConstraints.HORIZONTAL; ignoredFileNamesTextFieldConstraints.gridx = 0; ignoredFileNamesTextFieldConstraints.gridy = 1; ignoredFileNamesTextFieldConstraints.weightx = 1.0; ignoredFileNamesTextFieldConstraints.weighty = 1.0; ignoredFileNamesTextFieldConstraints.gridheight = 1; ignoredFileNamesTextFieldConstraints.gridwidth = 2; ignoredFileNamesTextFieldConstraints.insets = new Insets(2, 5, 5, 5); GridBagConstraints ignoredFileExtensionsLabelConstraints = new GridBagConstraints(); ignoredFileExtensionsLabelConstraints.anchor = GridBagConstraints.NORTHWEST; ignoredFileExtensionsLabelConstraints.fill = GridBagConstraints.NONE; ignoredFileExtensionsLabelConstraints.gridx = 0; ignoredFileExtensionsLabelConstraints.gridy = 2; ignoredFileExtensionsLabelConstraints.weightx = 1.0; ignoredFileExtensionsLabelConstraints.weighty = 1.0; ignoredFileExtensionsLabelConstraints.gridheight = 1; ignoredFileExtensionsLabelConstraints.gridwidth = 1; ignoredFileExtensionsLabelConstraints.insets = new Insets(5, 10, 0, 5); final JLabel ignoredFileExtensionsLabel = new JLabel("Ignored File Extensions", SwingConstants.LEFT); scanSettingsPanel.add(ignoredFileExtensionsLabel, ignoredFileExtensionsLabelConstraints); GridBagConstraints ignoredFileExtensionsTextFieldConstraints = new GridBagConstraints(); ignoredFileExtensionsTextFieldConstraints.anchor = GridBagConstraints.NORTH; ignoredFileExtensionsTextFieldConstraints.fill = GridBagConstraints.HORIZONTAL; ignoredFileExtensionsTextFieldConstraints.gridx = 0; ignoredFileExtensionsTextFieldConstraints.gridy = 3; ignoredFileExtensionsTextFieldConstraints.weightx = 1.0; ignoredFileExtensionsTextFieldConstraints.weighty = 1.0; ignoredFileExtensionsTextFieldConstraints.gridheight = 1; ignoredFileExtensionsTextFieldConstraints.gridwidth = 2; ignoredFileExtensionsTextFieldConstraints.insets = new Insets(2, 5, 5, 5); scanSettingsPanel.add(this.ignoredFileNamesTextField, ignoredFileNamesTextFieldConstraints); this.ignoredFileNamesTextField.getDocument().addDocumentListener(this.textPropertyValidationListener); scanSettingsPanel.add(this.ignoredFileExtensionsTextField, ignoredFileExtensionsTextFieldConstraints); this.ignoredFileExtensionsTextField.getDocument() .addDocumentListener(this.textPropertyValidationListener); GridBagConstraints numberScanThreadsLabelConstraints = new GridBagConstraints(); numberScanThreadsLabelConstraints.anchor = GridBagConstraints.NORTH; numberScanThreadsLabelConstraints.fill = GridBagConstraints.NONE; numberScanThreadsLabelConstraints.gridx = 0; numberScanThreadsLabelConstraints.gridy = 4; numberScanThreadsLabelConstraints.weightx = 1.0; numberScanThreadsLabelConstraints.weighty = 1.0; numberScanThreadsLabelConstraints.gridheight = 1; numberScanThreadsLabelConstraints.gridwidth = 1; numberScanThreadsLabelConstraints.insets = new Insets(10, 5, 0, 5); final JLabel numberOfThreadsLabel = new JLabel("Number of Threads", SwingConstants.RIGHT); scanSettingsPanel.add(numberOfThreadsLabel, numberScanThreadsLabelConstraints); GridBagConstraints numberScanThreadsSpinnerConstraints = new GridBagConstraints(); numberScanThreadsSpinnerConstraints.anchor = GridBagConstraints.NORTHWEST; numberScanThreadsSpinnerConstraints.fill = GridBagConstraints.NONE; numberScanThreadsSpinnerConstraints.gridx = 1; numberScanThreadsSpinnerConstraints.gridy = 4; numberScanThreadsSpinnerConstraints.weightx = 1.0; numberScanThreadsSpinnerConstraints.weighty = 1.0; numberScanThreadsSpinnerConstraints.gridheight = 1; numberScanThreadsSpinnerConstraints.gridwidth = 1; numberScanThreadsSpinnerConstraints.insets = new Insets(5, 5, 5, 5); scanSettingsPanel.add(this.numberScanThreadsSpinner, numberScanThreadsSpinnerConstraints); if (this.configuration != null) { this.ignoredFileNamesTextField.setText(this.configuration.getIgnoredFileNames()); this.ignoredFileExtensionsTextField.setText(this.configuration.getIgnoredFileExtensions()); this.numberScanThreadsSpinner.setValue(this.configuration.getNumberOfScanThreads()); } this.initialized = true; } }
From source file:net.chaosserver.timelord.swingui.TaskDayPanel.java
/** * Builds the panel. This uses a GridBag to try and make formatting * grid-like between the unconnected rows. *//*w w w .jav a2 s. c o m*/ protected void buildPanel() { GridBagLayout gridBagLayout = new GridBagLayout(); GridBagConstraints gridBagConstraints = new GridBagConstraints(); Insets defaultInsets = gridBagConstraints.insets; setLayout(gridBagLayout); taskName = new JLabel(); if (timelordTask.isHidden()) { Font taskFont = taskName.getFont(); Font italicFont = new Font(taskFont.getName(), Font.ITALIC, taskFont.getSize()); taskName.setFont(italicFont); } updateTaskNameLabel(); gridBagConstraints.anchor = GridBagConstraints.WEST; gridBagConstraints.weightx = LayoutConstants.HEAVY_WEIGHT; gridBagConstraints.insets = new Insets(0, LayoutConstants.SMALL_INSET, 0, LayoutConstants.BIG_INSET); gridBagConstraints.fill = GridBagConstraints.HORIZONTAL; gridBagLayout.addLayoutComponent(taskName, gridBagConstraints); add(taskName); minusButton = new JButton("-" + DateUtil.getSmallestTimeInMinutes() + "m"); minusButton.setToolTipText("Remove 15 minutes (0.25 hours) " + "of time from this task."); minusButton.setActionCommand(ACTION_MINUS_15); minusButton.addActionListener(this); gridBagConstraints.anchor = GridBagConstraints.CENTER; gridBagConstraints.insets = defaultInsets; gridBagConstraints.fill = GridBagConstraints.NONE; gridBagConstraints.weightx = 0; gridBagLayout.addLayoutComponent(minusButton, gridBagConstraints); add(minusButton); addButton = new JButton("+" + DateUtil.getSmallestTimeInMinutes() + "m"); addButton.setToolTipText("Add 15 minutes (0.25 hours) of " + "time from this task."); addButton.setActionCommand(ACTION_ADD_15); addButton.addActionListener(this); gridBagConstraints.anchor = GridBagConstraints.CENTER; gridBagConstraints.insets = defaultInsets; gridBagConstraints.fill = GridBagConstraints.NONE; gridBagConstraints.weightx = 0; gridBagLayout.addLayoutComponent(addButton, gridBagConstraints); add(addButton); timeLabel = new JLabel(); if (todayTaskDay != null) { timeLabel.setText(DateUtil.formatHours(null, todayTaskDay.getHours())); } else { timeLabel.setText(DateUtil.formatHours(null, 0)); } gridBagConstraints.anchor = GridBagConstraints.EAST; gridBagConstraints.fill = GridBagConstraints.NONE; gridBagConstraints.weightx = 0; gridBagConstraints.insets = new Insets(0, LayoutConstants.BIG_INSET, 0, LayoutConstants.SMALL_INSET); gridBagLayout.addLayoutComponent(timeLabel, gridBagConstraints); add(timeLabel); enabledButtons(); }
From source file:Data.java
/** * This method is called from within the constructor to initialize the form. * WARNING: Do NOT modify this code. The content of this method is always * regenerated by the Form Editor.// w ww.j a v a 2 s. c o m * @throws ClassNotFoundException * @throws IOException * @throws SQLException */ @SuppressWarnings("unchecked") // <editor-fold defaultstate="collapsed" desc="Generated Code"> private void initComponents() throws ClassNotFoundException, IOException, SQLException { Connection dataFridge = getDbConnection(); Statement stmt = dataFridge.createStatement(); GridBagConstraints gridBagConstraints; panelPrincipal = new JPanel(); panelCenter = new JPanel(); panelHeader = new JPanel(); btnHome = new JButton(); dataList = new JComboBox(); btnOk = new JButton(); panelData = new JScrollPane(); panelRealTime = new JPanel(); tempRealTime = new JLabel(); humRealTime = new JLabel(); // Set unit temperature switch (param.tempUnitList.getSelectedIndex()) { case 0: tempUnit = "C"; break; case 1: tempUnit = "F"; break; default: break; } setPreferredSize(new Dimension(512, 400)); setLayout(null); panelPrincipal.setPreferredSize(new Dimension(512, 400)); panelPrincipal.setLayout(new BorderLayout()); panelHeader.setPreferredSize(new Dimension(512, 40)); panelHeader.setLayout(new GridBagLayout()); ClassLoader classLoader = Thread.currentThread().getContextClassLoader(); InputStream input = classLoader.getResourceAsStream("home.png"); Image iconeHome = ImageIO.read(input); btnHome.setIcon(new ImageIcon(iconeHome)); btnHome.setPreferredSize(new Dimension(40, 40)); gridBagConstraints = new GridBagConstraints(); gridBagConstraints.anchor = GridBagConstraints.LINE_START; gridBagConstraints.insets = new Insets(0, 0, 0, 50); panelHeader.add(btnHome, gridBagConstraints); dataList.setModel( new DefaultComboBoxModel(new String[] { "Donnes en temps rel", "Graphique des temperatures" })); dataList.setPreferredSize(new Dimension(250, 40)); gridBagConstraints = new GridBagConstraints(); gridBagConstraints.anchor = GridBagConstraints.LINE_END; gridBagConstraints.insets = new Insets(0, 0, 0, 10); panelHeader.add(dataList, gridBagConstraints); btnOk.setFont(new Font("Tahoma", 0, 10)); // NOI18N btnOk.setText("OK"); btnOk.setPreferredSize(new Dimension(60, 40)); btnOk.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent evt) { btnOKActionPerformed(evt); } }); gridBagConstraints = new GridBagConstraints(); gridBagConstraints.anchor = GridBagConstraints.LINE_START; gridBagConstraints.insets = new Insets(0, 5, 0, 70); panelHeader.add(btnOk, gridBagConstraints); panelPrincipal.add(panelHeader, BorderLayout.NORTH); panelCenter.setLayout(new BorderLayout()); JFreeChart chart = createChart(createDataset(stmt)); panelChart = new ChartPanel(chart); panelChart.setVisible(true); panelData = new JScrollPane(getTbleData(stmt)); tempRealTime.setFont(new java.awt.Font("Meiryo UI", 1, 18)); // NOI18N humRealTime.setFont(new java.awt.Font("Meiryo UI", 1, 18)); // NOI18N panelRealTime.setLayout(new GridBagLayout()); gridBagConstraints = new GridBagConstraints(); gridBagConstraints.gridx = 0; gridBagConstraints.gridy = 0; gridBagConstraints.insets = new Insets(18, 0, 0, 0); gridBagConstraints.anchor = GridBagConstraints.LINE_START; panelRealTime.add(tempRealTime, gridBagConstraints); gridBagConstraints = new GridBagConstraints(); gridBagConstraints.gridx = 0; gridBagConstraints.gridy = 1; gridBagConstraints.insets = new Insets(0, 0, 10, 0); gridBagConstraints.anchor = GridBagConstraints.LINE_START; panelRealTime.add(humRealTime, gridBagConstraints); panelCenter.add(panelRealTime, BorderLayout.NORTH); panelCenter.add(panelData, BorderLayout.CENTER); panelPrincipal.add(panelCenter, BorderLayout.CENTER); add(panelPrincipal); panelPrincipal.setBounds(0, 0, 512, 340); stmt.close(); dataFridge.close(); }
From source file:com.pos.spatobiz.app.view.karyawan.MenuKaryawan.java
/** This method is called from within the constructor to * initialize the form.//from w ww .j ava2 s. c om * WARNING: Do NOT modify this code. The content of this method is * always regenerated by the Form Editor. */ @SuppressWarnings("unchecked") // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents private void initComponents() { buttonDataKaryawan = new BigButton(); buttonTambahKaryawan = new BigButton(); buttonEditKaryawan = new BigButton(); buttonHapusKaryawan = new BigButton(); setLayout(new GridBagLayout()); buttonDataKaryawan.setIcon(new ImageIcon( getClass().getResource("/com/pos/spatobiz/app/resource/image/karyawan/karyawan.png"))); // NOI18N buttonDataKaryawan.setText("Data Karyawan"); add(buttonDataKaryawan, new GridBagConstraints()); buttonTambahKaryawan.setIcon( new ImageIcon(getClass().getResource("/com/pos/spatobiz/app/resource/image/karyawan/tambah.png"))); // NOI18N buttonTambahKaryawan.setText("Tambah Karyawan"); add(buttonTambahKaryawan, new GridBagConstraints()); buttonEditKaryawan.setIcon(new ImageIcon( getClass().getResource("/com/pos/spatobiz/app/resource/image/karyawan/karyawan.png"))); // NOI18N buttonEditKaryawan.setText("Ubah Karyawan"); add(buttonEditKaryawan, new GridBagConstraints()); buttonHapusKaryawan.setText("Hapus Karyawan"); add(buttonHapusKaryawan, new GridBagConstraints()); }
From source file:rhinova.gui.dataentry.link.LinkDataEntryPanel.java
private void initComponents() { // JFormDesigner - Component initialization - DO NOT MODIFY //GEN-BEGIN:initComponents // Generated using JFormDesigner non-commercial license vSpacer5 = new JPanel(null); label2 = new JLabel(); hSpacer1 = new JPanel(null); label1 = new JLabel(); txtName = new JTextField(); vSpacer4 = new JPanel(null); label6 = new JLabel(); txtCap = new JTextField(); vSpacer3 = new JPanel(null); label7 = new JLabel(); txtSur = new JTextField(); hSpacer2 = new JPanel(null); vSpacer2 = new JPanel(null); label8 = new JLabel(); res1 = new JComboBox(); vSpacer1 = new JPanel(null); label9 = new JLabel(); res2 = new JComboBox(); vSpacer6 = new JPanel(null); btnCreate = new JButton(); hSpacer3 = new JPanel(null); //======== this ======== setLayout(new GridBagLayout()); ((GridBagLayout) getLayout()).columnWidths = new int[] { 0, 65, 145, 0, 0 }; ((GridBagLayout) getLayout()).rowHeights = new int[] { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; ((GridBagLayout) getLayout()).columnWeights = new double[] { 0.0, 0.0, 0.0, 0.0, 1.0E-4 }; ((GridBagLayout) getLayout()).rowWeights = new double[] { 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0E-4 }; add(vSpacer5, new GridBagConstraints(2, 0, 1, 1, 0.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.BOTH, new Insets(0, 0, 5, 5), 0, 0)); //---- label2 ---- label2.setText("Link Entry Panel"); label2.setFont(new Font("Tahoma", Font.PLAIN, 16)); add(label2, new GridBagConstraints(2, 1, 1, 1, 0.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.BOTH, new Insets(0, 0, 5, 5), 0, 0)); add(hSpacer1, new GridBagConstraints(0, 2, 1, 1, 0.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.BOTH, new Insets(0, 0, 5, 5), 0, 0)); //---- label1 ---- label1.setText("name"); add(label1, new GridBagConstraints(1, 2, 1, 1, 0.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.BOTH, new Insets(0, 0, 5, 5), 0, 0)); add(txtName, new GridBagConstraints(2, 2, 1, 1, 0.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.BOTH, new Insets(0, 0, 5, 5), 0, 0)); add(vSpacer4, new GridBagConstraints(1, 3, 1, 1, 0.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.BOTH, new Insets(0, 0, 5, 5), 0, 0)); //---- label6 ---- label6.setText("capacity"); add(label6, new GridBagConstraints(1, 4, 1, 1, 0.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.BOTH, new Insets(0, 0, 5, 5), 0, 0)); add(txtCap, new GridBagConstraints(2, 4, 1, 1, 0.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.BOTH, new Insets(0, 0, 5, 5), 0, 0)); add(vSpacer3, new GridBagConstraints(1, 5, 1, 1, 0.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.BOTH, new Insets(0, 0, 5, 5), 0, 0)); //---- label7 ---- label7.setText("survival rate"); add(label7, new GridBagConstraints(1, 6, 1, 1, 0.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.BOTH, new Insets(0, 0, 5, 5), 0, 0)); add(txtSur, new GridBagConstraints(2, 6, 1, 1, 0.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.BOTH, new Insets(0, 0, 5, 5), 0, 0)); add(hSpacer2, new GridBagConstraints(3, 6, 1, 1, 0.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.BOTH, new Insets(0, 0, 5, 0), 0, 0)); add(vSpacer2, new GridBagConstraints(1, 7, 1, 1, 0.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.BOTH, new Insets(0, 0, 5, 5), 0, 0)); //---- label8 ---- label8.setText("reserve1"); add(label8, new GridBagConstraints(1, 8, 1, 1, 0.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.BOTH, new Insets(0, 0, 5, 5), 0, 0)); add(res1, new GridBagConstraints(2, 8, 1, 1, 0.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.BOTH, new Insets(0, 0, 5, 5), 0, 0)); add(vSpacer1, new GridBagConstraints(1, 9, 1, 1, 0.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.BOTH, new Insets(0, 0, 5, 5), 0, 0)); //---- label9 ---- label9.setText("reserve2"); add(label9, new GridBagConstraints(1, 10, 1, 1, 0.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.BOTH, new Insets(0, 0, 5, 5), 0, 0)); add(res2, new GridBagConstraints(2, 10, 1, 1, 0.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.BOTH, new Insets(0, 0, 5, 5), 0, 0)); add(vSpacer6, new GridBagConstraints(1, 11, 1, 1, 0.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.BOTH, new Insets(0, 0, 5, 5), 0, 0)); //---- btnCreate ---- btnCreate.setText("Create Link"); btnCreate.addActionListener(new ActionListener() { @Override/*from ww w . j a v a 2s.co m*/ public void actionPerformed(ActionEvent e) { btnCreateActionPerformed(e); } }); add(btnCreate, new GridBagConstraints(2, 12, 1, 1, 0.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.BOTH, new Insets(0, 0, 5, 5), 0, 0)); add(hSpacer3, new GridBagConstraints(2, 13, 1, 1, 0.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.BOTH, new Insets(0, 0, 0, 5), 0, 0)); // JFormDesigner - End of component initialization //GEN-END:initComponents }
From source file:com.socrata.datasync.ui.MetadataJobTab.java
public MetadataJobTab(MetadataJob job, JFrame containingFrame) { this.metadataJob = job; mainFrame = containingFrame;/*from w w w . java 2 s.c om*/ // build tab panel form //jobPanel = new JPanel(new GridLayout(0,2)); jobPanel = new JPanel(new GridBagLayout()); // set FlowLayouts FlowLayout flowLeft = new FlowLayout(FlowLayout.LEFT, 0, 0); FlowLayout flowRight = new FlowLayout(FlowLayout.LEFT, 0, JOB_FIELD_VGAP); //Dataset ID Text Field jobPanel.add( UIUtility.generateLabelWithHelpBubble("Dataset ID", DATASET_ID_TIP_TEXT, HELP_ICON_TOP_PADDING), UIUtility.getGridBagLabelConstraints(0, 0)); JPanel datasetIDTextFieldContainer = new JPanel(flowRight); datasetIDTextField = new JTextField(); datasetIDTextField.setPreferredSize(new Dimension(JOB_TEXTFIELD_WIDTH, JOB_TEXTFIELD_HEIGHT)); datasetIDTextFieldContainer.add(datasetIDTextField); jobPanel.add(datasetIDTextFieldContainer, UIUtility.getGridBagFieldConstraints(1, 0)); //Load Metadata Button jobPanel.add(new JLabel("")); JPanel loadMetadataButtonContainer = new JPanel(flowRight); JButton loadMetadataButton = new JButton("Load Current Dataset Metadata"); loadMetadataButton.addActionListener(new LoadMetadataActionListener()); loadMetadataButtonContainer.add(loadMetadataButton); loadMetadataButtonContainer.add(UIUtility.generateHelpBubble(LOAD_METADATA_TIP_TEXT)); jobPanel.add(loadMetadataButtonContainer, UIUtility.getGridBagFieldConstraints(1, 1)); //Title Text Field jobPanel.add(UIUtility.generateLabelWithHelpBubble("Title", TITLE_TIP_TEXT, HELP_ICON_TOP_PADDING), UIUtility.getGridBagLabelConstraints(0, 2)); JPanel titleTextFieldContainer = new JPanel(flowRight); titleTextField = new JTextField(); titleTextField.setPreferredSize(new Dimension(JOB_TEXTFIELD_WIDTH, JOB_TEXTFIELD_HEIGHT)); titleTextFieldContainer.add(titleTextField); jobPanel.add(titleTextFieldContainer, UIUtility.getGridBagFieldConstraints(1, 2)); //Description Text Area jobPanel.add( UIUtility.generateLabelWithHelpBubble("Description", DESCRIPTION_TIP_TEXT, HELP_ICON_TOP_PADDING), UIUtility.getGridBagLabelConstraints(0, 3)); JPanel descriptionTextFieldContainer = new JPanel(); descriptionTextArea = new JTextArea(5, 33); descriptionTextArea.setLineWrap(true); descriptionTextArea.setWrapStyleWord(true); JScrollPane descriptionScrollPane = new JScrollPane(descriptionTextArea); descriptionTextFieldContainer.add(descriptionScrollPane); GridBagConstraints constraints = new GridBagConstraints(); constraints.gridx = 1; constraints.gridy = 3; constraints.weightx = 0; constraints.anchor = GridBagConstraints.LINE_START; constraints.ipadx = -10; //Not sure why, but text area was getting extra margin so left edge didn't line up with other fields jobPanel.add(descriptionTextFieldContainer, constraints); //Category Text Field jobPanel.add(UIUtility.generateLabelWithHelpBubble("Category", CATEGORY_TIP_TEXT, HELP_ICON_TOP_PADDING), UIUtility.getGridBagLabelConstraints(0, 4)); JPanel categoryTextFieldContainer = new JPanel(flowRight); categoryTextField = new JTextField(); categoryTextField.setPreferredSize(new Dimension(JOB_TEXTFIELD_WIDTH, JOB_TEXTFIELD_HEIGHT)); categoryTextFieldContainer.add(categoryTextField); jobPanel.add(categoryTextFieldContainer, UIUtility.getGridBagFieldConstraints(1, 4)); //Tags/Keywords Text Field jobPanel.add( UIUtility.generateLabelWithHelpBubble("Tags/Keywords", KEYWORDS_TIP_TEXT, HELP_ICON_TOP_PADDING), UIUtility.getGridBagLabelConstraints(0, 5)); JPanel keywordsTextFieldContainer = new JPanel(flowRight); keywordsTextField = new JTextField(); keywordsTextField.setPreferredSize(new Dimension(JOB_TEXTFIELD_WIDTH, JOB_TEXTFIELD_HEIGHT)); keywordsTextFieldContainer.add(keywordsTextField); jobPanel.add(keywordsTextFieldContainer, UIUtility.getGridBagFieldConstraints(1, 5)); //License Type Combo Box jobPanel.add( UIUtility.generateLabelWithHelpBubble("License Type", LICENSE_TYPE_TIP_TEXT, HELP_ICON_TOP_PADDING), UIUtility.getGridBagLabelConstraints(0, 6)); JPanel licenseTypeContainer = new JPanel(flowRight); licenseTypeComboBox = new JComboBox(); for (LicenseType licenseType : LicenseType.values()) { licenseTypeComboBox.addItem(licenseType); } licenseTypeContainer.add(licenseTypeComboBox); jobPanel.add(licenseTypeContainer, UIUtility.getGridBagFieldConstraints(1, 6)); //Data Provided By Text Field jobPanel.add(UIUtility.generateLabelWithHelpBubble("Data Provided By", DATA_PROVIDED_BY_TIP_TEXT, HELP_ICON_TOP_PADDING), UIUtility.getGridBagLabelConstraints(0, 7)); JPanel dataProvidedByTextFieldContainer = new JPanel(flowRight); dataProvidedByTextField = new JTextField(); dataProvidedByTextField.setPreferredSize(new Dimension(JOB_TEXTFIELD_WIDTH, JOB_TEXTFIELD_HEIGHT)); dataProvidedByTextFieldContainer.add(dataProvidedByTextField); jobPanel.add(dataProvidedByTextFieldContainer, UIUtility.getGridBagFieldConstraints(1, 7)); //Source Link Text Field jobPanel.add( UIUtility.generateLabelWithHelpBubble("Source Link", SOURCE_LINK_TIP_TEXT, HELP_ICON_TOP_PADDING), UIUtility.getGridBagLabelConstraints(0, 8)); JPanel sourceLinkTextFieldContainer = new JPanel(flowRight); sourceLinkTextField = new JTextField(); sourceLinkTextField.setPreferredSize(new Dimension(JOB_TEXTFIELD_WIDTH, JOB_TEXTFIELD_HEIGHT)); sourceLinkTextFieldContainer.add(sourceLinkTextField); jobPanel.add(sourceLinkTextFieldContainer, UIUtility.getGridBagFieldConstraints(1, 8)); //Contact Info Text Field jobPanel.add( UIUtility.generateLabelWithHelpBubble("Contact Info", CONTACT_INFO_TIP_TEXT, HELP_ICON_TOP_PADDING), UIUtility.getGridBagLabelConstraints(0, 9)); JPanel contactInfoTextFieldContainer = new JPanel(flowRight); contactInfoTextField = new JTextField(); contactInfoTextField.setPreferredSize(new Dimension(JOB_TEXTFIELD_WIDTH, JOB_TEXTFIELD_HEIGHT)); contactInfoTextFieldContainer.add(contactInfoTextField); jobPanel.add(contactInfoTextFieldContainer, UIUtility.getGridBagFieldConstraints(1, 9)); //Command to execute jobPanel.add(UIUtility.generateLabelWithHelpBubble("Command to execute with scheduler", RUN_COMMAND_TIP_TEXT, HELP_ICON_TOP_PADDING), UIUtility.getGridBagLabelConstraints(0, 10)); JPanel runCommandTextFieldContainer = new JPanel(flowRight); runCommandTextField = new JTextField(DEFAULT_RUN_JOB_COMMAND); runCommandTextField.setPreferredSize(new Dimension(JOB_COMMAND_TEXTFIELD_WIDTH, JOB_TEXTFIELD_HEIGHT)); runCommandTextField.setEditable(false); runCommandTextField.addMouseListener(new JobCommandTextFieldListener()); runCommandTextFieldContainer.add(runCommandTextField); JButton copyJobCommandButton = new JButton("Copy to clipboard"); copyJobCommandButton.addActionListener(new CopyJobCommandListener()); runCommandTextFieldContainer.add(copyJobCommandButton); jobPanel.add(runCommandTextFieldContainer, UIUtility.getGridBagFieldConstraints(1, 10)); // Load job data into fields populateFieldsFromJobData(); jobTabTitleLabel = new JLabel(job.getJobFilename()); }
From source file:com.sec.ose.osi.ui.frm.main.identification.JPanIdentifyResetComment.java
private void initialize() { GridBagConstraints gridBagConstraintsPanelComment = new GridBagConstraints(); gridBagConstraintsPanelComment.fill = GridBagConstraints.BOTH; gridBagConstraintsPanelComment.gridx = 0; gridBagConstraintsPanelComment.gridy = 0; gridBagConstraintsPanelComment.weightx = 1.0; gridBagConstraintsPanelComment.weighty = 1.0; GridBagConstraints gridBagConstraintsOKResetBtn = new GridBagConstraints(); gridBagConstraintsOKResetBtn.anchor = GridBagConstraints.NORTHWEST; gridBagConstraintsOKResetBtn.insets = new Insets(10, 10, 0, 10); gridBagConstraintsOKResetBtn.gridx = 1; gridBagConstraintsOKResetBtn.gridy = 0; this.setLayout(new GridBagLayout()); this.add(getJScrollPaneComment(), gridBagConstraintsPanelComment); this.add(getJPanelOkResetBtn(), gridBagConstraintsOKResetBtn); }
From source file:it.cnr.icar.eric.client.ui.swing.FindParamsPanel.java
/** * Class Constructor./* w ww.j av a2 s . co m*/ */ public FindParamsPanel(DiscoveryPanel discoveryPanel) throws JAXRException { this.discoveryPanel = discoveryPanel; GridBagLayout gbl = new GridBagLayout(); setLayout(gbl); //The searchTypeSelectionPanel at the top of the panel JPanel searchTypePanel = createSearchTypePanel(); c.gridx = 0; c.gridy = 0; c.gridwidth = 1; c.gridheight = 1; c.weightx = 0.0; c.weighty = 0.0; c.fill = GridBagConstraints.NONE; c.anchor = GridBagConstraints.NORTH; c.insets = new Insets(4, 4, 0, 4); gbl.setConstraints(searchTypePanel, c); add(searchTypePanel); //The federated CheckBox federatedCheckBox = new JCheckBox(resourceBundle.getString("label.federatedQuery")); federatedCheckBox.setSelected(false); federatedCheckBox.setEnabled(true); c.gridx = 0; c.gridy = 1; c.gridwidth = 1; c.gridheight = 1; c.weightx = 0.0; c.weighty = 0.0; c.fill = GridBagConstraints.NONE; c.anchor = GridBagConstraints.NORTH; c.insets = new Insets(4, 4, 0, 4); gbl.setConstraints(federatedCheckBox, c); add(federatedCheckBox); //The actionPanel JPanel actionPanel = createActionPanel(); c.gridx = 0; c.gridy = 2; c.gridwidth = 1; c.gridheight = 1; c.weightx = 0.0; c.weighty = 0.0; c.fill = GridBagConstraints.NONE; c.anchor = GridBagConstraints.NORTH; c.insets = new Insets(4, 4, 0, 4); gbl.setConstraints(searchTypePanel, c); add(actionPanel); //Next is the panel that is the parent of both adhocQueryPanel and //businessQueryPanel paramEntryParentPanel = createParamEntryParentPanel(); c.gridx = 0; c.gridy = 3; c.gridwidth = 1; c.gridheight = 1; c.weightx = 0.5; c.weighty = 0.5; c.fill = GridBagConstraints.BOTH; c.anchor = GridBagConstraints.NORTH; c.insets = new Insets(4, 4, 0, 4); gbl.setConstraints(paramEntryParentPanel, c); add(paramEntryParentPanel); //RegistryBrowser.getInstance().getConceptsTreeDialog().addPropertyChangeListener(this); //add listener for 'locale' bound property RegistryBrowser.getInstance().addPropertyChangeListener(RegistryBrowser.PROPERTY_LOCALE, this); }
From source file:logdruid.ui.DateEditor.java
/** * Create the panel.// w ww.ja v a2 s . co m */ public DateEditor(Repository rep) { repository = rep; model = new MyTableModel2(data, header); GridBagLayout gridBagLayout = new GridBagLayout(); gridBagLayout.columnWidths = new int[] { 15, 550, 15 }; gridBagLayout.rowHeights = new int[] { 152, 300 }; gridBagLayout.columnWeights = new double[] { 0.0, 1.0, 0.0 }; gridBagLayout.rowWeights = new double[] { 0.0, 1.0 }; setLayout(gridBagLayout); JPanel panel_1 = new JPanel(); GridBagConstraints gbc_panel_1 = new GridBagConstraints(); gbc_panel_1.fill = GridBagConstraints.BOTH; gbc_panel_1.insets = new Insets(5, 0, 5, 5); gbc_panel_1.gridx = 1; gbc_panel_1.gridy = 0; add(panel_1, gbc_panel_1); panel_1.setLayout(new BorderLayout(0, 0)); table = new JTable(model); table.setSelectionMode(ListSelectionModel.SINGLE_SELECTION); table.setBorder(UIManager.getBorder("TextPane.border")); table.setPreferredScrollableViewportSize(new Dimension(0, 0)); table.setFillsViewportHeight(true); table.getSelectionModel().addListSelectionListener(new ListSelectionListener() { public void valueChanged(ListSelectionEvent e) { // ((table.getSelectedRow()!=-1)?table.convertRowIndexToModel(table.getSelectedRow()):-1) // persist repository // display selected row if (((table.getSelectedRow() != -1) ? table.convertRowIndexToModel(table.getSelectedRow()) : -1) >= 0) { /* * recEditor = new RecordingEditor(repository * .getRecordings().get(((table.getSelectedRow()!=-1)?table. * convertRowIndexToModel(table.getSelectedRow()):-1)), * repository); jPanelDetail.removeAll(); */ // jPanelDetail.add(recEditor, gbc_jPanelDetail); DateFormat df = repository.getDateFormat( ((table.getSelectedRow() != -1) ? table.convertRowIndexToModel(table.getSelectedRow()) : -1)); if (df != null) { textFieldName.setText((String) df.getName()); textFieldPattern.setText((String) df.getPattern()); textField.setText((String) df.getDateFormat()); } // jPanelDetail.revalidate(); // jPanelDetail.repaint(); // jPanelDetail.setVisible(true); // reloadTable(); those 2 ******** // jPanelDetail.revalidate(); } } }); JScrollPane scrollPane = new JScrollPane(table); panel_1.add(scrollPane, BorderLayout.CENTER); // Set up column sizes. initColumnSizes(table); JPanel panel = new JPanel(); FlowLayout flowLayout = (FlowLayout) panel.getLayout(); flowLayout.setAlignment(FlowLayout.LEFT); flowLayout.setVgap(2); flowLayout.setHgap(2); panel_1.add(panel, BorderLayout.SOUTH); JButton btnNew = new JButton("New"); panel.add(btnNew); btnNew.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent arg0) { DateFormat df = new DateFormat("name", "\\w{3}\\s[0-9]{1}/[0-9]{2}/[0-9]{2}\\s\\d\\d:\\d\\d:\\d\\d", "EEE. MM/dd/yy HH:mm:ss"); repository.addDateFormat(df); data.add(new Object[] { df.getName(), df.getPattern(), df.getDateFormat() }); table.repaint(); } }); JButton btnDuplicate = new JButton("Duplicate"); btnDuplicate.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { if (((table.getSelectedRow() != -1) ? table.convertRowIndexToModel(table.getSelectedRow()) : -1) >= 0) { DateFormat df = repository.getDateFormat( ((table.getSelectedRow() != -1) ? table.convertRowIndexToModel(table.getSelectedRow()) : -1)); repository.addDateFormat(df); reloadTable(); // data.add(new Object[] { table.getRowCount()+1, // df.getName(),df.getDateFormat()}); table.repaint(); } } }); panel.add(btnDuplicate); JButton btnDelete = new JButton("Delete"); btnDelete.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { int selectedRow = ((table.getSelectedRow() != -1) ? table.convertRowIndexToModel(table.getSelectedRow()) : -1); if (selectedRow >= 0) { repository.deleteDateFormat( ((table.getSelectedRow() != -1) ? table.convertRowIndexToModel(table.getSelectedRow()) : -1)); data.remove( ((table.getSelectedRow() != -1) ? table.convertRowIndexToModel(table.getSelectedRow()) : -1)); reloadTable(); table.setRowSelectionInterval(selectedRow, selectedRow); table.repaint(); } } }); panel.add(btnDelete); jPanelDetail = new JPanel(); gbc_jPanelDetail = new GridBagConstraints(); gbc_jPanelDetail.anchor = GridBagConstraints.NORTH; gbc_jPanelDetail.fill = GridBagConstraints.HORIZONTAL; gbc_jPanelDetail.gridx = 1; gbc_jPanelDetail.gridy = 1; add(jPanelDetail, gbc_jPanelDetail); GridBagLayout gbl_jPanelDetail = new GridBagLayout(); gbl_jPanelDetail.columnWidths = new int[] { 169 }; gbl_jPanelDetail.rowHeights = new int[] { 0, 0, 0, 0, 150, 0 }; gbl_jPanelDetail.columnWeights = new double[] { 1.0, 0.0 }; gbl_jPanelDetail.rowWeights = new double[] { 0.0, 0.0, 0.0, 1.0, 1.0, 0.0 }; jPanelDetail.setLayout(gbl_jPanelDetail); JPanel panel_2 = new JPanel(); panel_2.setBorder(null); GridBagConstraints gbc_panel_2 = new GridBagConstraints(); gbc_panel_2.gridwidth = 2; gbc_panel_2.anchor = GridBagConstraints.NORTHWEST; gbc_panel_2.insets = new Insets(0, 0, 5, 0); gbc_panel_2.gridx = 0; gbc_panel_2.gridy = 0; jPanelDetail.add(panel_2, gbc_panel_2); panel_2.setLayout(new FlowLayout(FlowLayout.LEFT, 5, 5)); JLabel label = new JLabel("Name"); panel_2.add(label); textFieldName = new JTextField(); textFieldName.setColumns(20); panel_2.add(textFieldName); JPanel panel_3 = new JPanel(); FlowLayout flowLayout_1 = (FlowLayout) panel_3.getLayout(); flowLayout_1.setAlignment(FlowLayout.LEFT); panel_3.setBorder(null); GridBagConstraints gbc_panel_3 = new GridBagConstraints(); gbc_panel_3.insets = new Insets(0, 0, 5, 0); gbc_panel_3.gridwidth = 2; gbc_panel_3.anchor = GridBagConstraints.NORTHWEST; gbc_panel_3.gridx = 0; gbc_panel_3.gridy = 1; jPanelDetail.add(panel_3, gbc_panel_3); labelPattern = new JLabel("Pattern"); panel_3.add(labelPattern); textFieldPattern = new JTextField(); textFieldPattern.setColumns(40); panel_3.add(textFieldPattern); JButton btnSave = new JButton("Save"); btnSave.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { DateFormat df1 = repository.getDateFormat( ((table.getSelectedRow() != -1) ? table.convertRowIndexToModel(table.getSelectedRow()) : -1)); df1.update(textFieldName.getText(), textFieldPattern.getText(), textField.getText()); reloadTable(); } }); JPanel panel_4 = new JPanel(); FlowLayout flowLayout_2 = (FlowLayout) panel_4.getLayout(); flowLayout_2.setAlignment(FlowLayout.LEFT); GridBagConstraints gbc_panel_4 = new GridBagConstraints(); gbc_panel_4.anchor = GridBagConstraints.WEST; gbc_panel_4.insets = new Insets(0, 0, 5, 5); gbc_panel_4.gridx = 0; gbc_panel_4.gridy = 2; jPanelDetail.add(panel_4, gbc_panel_4); JLabel lblFastDateFormat = new JLabel("FastDateFormat"); panel_4.add(lblFastDateFormat); textField = new JTextField(); panel_4.add(textField); textField.setColumns(30); JPanel panel_5 = new JPanel(); FlowLayout flowLayout_3 = (FlowLayout) panel_5.getLayout(); flowLayout_3.setAlignment(FlowLayout.LEFT); GridBagConstraints gbc_panel_5 = new GridBagConstraints(); gbc_panel_5.insets = new Insets(0, 0, 5, 5); gbc_panel_5.fill = GridBagConstraints.BOTH; gbc_panel_5.gridx = 0; gbc_panel_5.gridy = 3; jPanelDetail.add(panel_5, gbc_panel_5); JLabel lblSampleLabel = new JLabel("Sample"); panel_5.add(lblSampleLabel); JPanel panel_6 = new JPanel(); panel_6.setBorder(new EtchedBorder(EtchedBorder.LOWERED, null, null)); GridBagConstraints gbc_panel_6 = new GridBagConstraints(); gbc_panel_6.ipady = 1; gbc_panel_6.ipadx = 1; gbc_panel_6.insets = new Insets(0, 0, 5, 5); gbc_panel_6.fill = GridBagConstraints.BOTH; gbc_panel_6.gridx = 0; gbc_panel_6.gridy = 4; jPanelDetail.add(panel_6, gbc_panel_6); panel_6.setLayout(new BorderLayout(0, 0)); JTextPane textPane = new JTextPane(); textPane.setBackground(UIManager.getColor("windowBorder")); panel_6.add(textPane); GridBagConstraints gbc_btnSave = new GridBagConstraints(); gbc_btnSave.anchor = GridBagConstraints.WEST; gbc_btnSave.insets = new Insets(0, 0, 0, 5); gbc_btnSave.gridx = 0; gbc_btnSave.gridy = 5; jPanelDetail.add(btnSave, gbc_btnSave); reloadTable(); }