List of usage examples for javax.swing BorderFactory createTitledBorder
public static TitledBorder createTitledBorder(Border border, String title, int titleJustification, int titlePosition)
From source file:Main.java
public Main() { getContentPane().setLayout(new FlowLayout()); JLabel labelTwo = new JLabel("www.java2s.com"); labelTwo.setBorder(BorderFactory.createEtchedBorder(EtchedBorder.RAISED)); add(labelTwo);/*from w w w . j a va 2 s .c om*/ JLabel labelThree = new JLabel("MatteBorder"); labelThree.setBorder(BorderFactory.createMatteBorder(10, 10, 10, 10, Color.pink)); add(labelThree); JLabel labelFour = new JLabel("TitledBorder"); labelFour.setBorder( BorderFactory.createTitledBorder(BorderFactory.createMatteBorder(10, 10, 10, 10, Color.pink), "Title", TitledBorder.RIGHT, TitledBorder.BOTTOM)); add(labelFour); JLabel labelSix = new JLabel("CompoundBorder"); Border one = BorderFactory.createEtchedBorder(); Border two = BorderFactory.createMatteBorder(4, 4, 4, 4, Color.blue); labelSix.setBorder(BorderFactory.createCompoundBorder(one, two)); add(labelSix); }
From source file:Main.java
public Main() { getContentPane().setLayout(new FlowLayout()); JLabel labelTwo = new JLabel("www.java2s.com"); labelTwo.setBorder(BorderFactory.createEtchedBorder(EtchedBorder.RAISED, Color.red, Color.black)); add(labelTwo);//from w w w . j a v a 2s . c o m JLabel labelThree = new JLabel("MatteBorder"); labelThree.setBorder(BorderFactory.createMatteBorder(10, 10, 10, 10, Color.pink)); add(labelThree); JLabel labelFour = new JLabel("TitledBorder"); labelFour.setBorder( BorderFactory.createTitledBorder(BorderFactory.createMatteBorder(10, 10, 10, 10, Color.pink), "Title", TitledBorder.RIGHT, TitledBorder.BOTTOM)); add(labelFour); JLabel labelSix = new JLabel("CompoundBorder"); Border one = BorderFactory.createEtchedBorder(); Border two = BorderFactory.createMatteBorder(4, 4, 4, 4, Color.blue); labelSix.setBorder(BorderFactory.createCompoundBorder(one, two)); add(labelSix); }
From source file:com.digitalgeneralists.assurance.ui.components.ExclusionsPanel.java
@Override protected void initializeComponent() { if (!this.initialized) { if (this.exclusion == null) { this.mode = AssuranceDialogMode.ADD; this.dialogTitle = "Add New Exclusion"; this.exclusion = new FileReference(); } else {//from www . j a va2 s. co m this.mode = AssuranceDialogMode.EDIT; this.dialogTitle = "Edit Exclusion"; } GridBagLayout gridbag = new GridBagLayout(); this.setLayout(gridbag); final JPanel exclusionPathPanel = new JPanel(); exclusionPathPanel.setLayout(new GridBagLayout()); Border exclusionPanelBorder = BorderFactory.createEtchedBorder(EtchedBorder.LOWERED); exclusionPanelBorder = BorderFactory.createTitledBorder(exclusionPanelBorder, "Exclusion", TitledBorder.CENTER, TitledBorder.TOP); GridBagConstraints exclusionPathPanelConstraints = new GridBagConstraints(); exclusionPathPanelConstraints.anchor = GridBagConstraints.NORTH; exclusionPathPanelConstraints.fill = GridBagConstraints.HORIZONTAL; exclusionPathPanelConstraints.gridx = 0; exclusionPathPanelConstraints.gridy = 0; exclusionPathPanelConstraints.weightx = 1.0; exclusionPathPanelConstraints.weighty = 1.0; exclusionPathPanelConstraints.gridheight = 1; exclusionPathPanelConstraints.gridwidth = 2; exclusionPathPanelConstraints.insets = new Insets(5, 5, 5, 5); exclusionPathPanel.setBorder(exclusionPanelBorder); this.add(exclusionPathPanel, exclusionPathPanelConstraints); GridBagConstraints exclusionPathFieldConstraints = new GridBagConstraints(); exclusionPathFieldConstraints.anchor = GridBagConstraints.NORTH; exclusionPathFieldConstraints.fill = GridBagConstraints.HORIZONTAL; exclusionPathFieldConstraints.gridx = 0; exclusionPathFieldConstraints.gridy = 1; exclusionPathFieldConstraints.weightx = 1.0; exclusionPathFieldConstraints.weighty = 1.0; exclusionPathFieldConstraints.gridheight = 1; exclusionPathFieldConstraints.gridwidth = 1; exclusionPathFieldConstraints.insets = new Insets(5, 5, 5, 5); exclusionPathPanel.add(this.exclusionPathTextFieldPicker, exclusionPathFieldConstraints); if (this.exclusion != null) { File exclusionPath = exclusion.getFile(); if (exclusionPath != null) { this.exclusionPathTextFieldPicker.setValue(exclusionPath.getPath()); } else { this.exclusionPathTextFieldPicker.setValue(""); } } this.initialized = true; } }
From source file:com.digitalgeneralists.assurance.ui.components.ScanPathMappingPanel.java
protected void initializeComponent() { if (!this.initialized) { if (this.mappingDefinition == null) { this.mode = AssuranceDialogMode.ADD; this.dialogTitle = "Add New Path Mapping"; this.mappingDefinition = new ScanMappingDefinition(); } else {//from w ww .j a v a 2 s . com this.mode = AssuranceDialogMode.EDIT; this.dialogTitle = "Edit Path Mapping"; } GridBagLayout gridbag = new GridBagLayout(); this.setLayout(gridbag); final JPanel scanPathsPanel = new JPanel(); scanPathsPanel.setLayout(new GridBagLayout()); Border pathsPanelBorder = BorderFactory.createEtchedBorder(EtchedBorder.LOWERED); pathsPanelBorder = BorderFactory.createTitledBorder(pathsPanelBorder, "Paths", TitledBorder.CENTER, TitledBorder.TOP); GridBagConstraints scanPathsPanelConstraints = new GridBagConstraints(); scanPathsPanelConstraints.anchor = GridBagConstraints.NORTH; scanPathsPanelConstraints.fill = GridBagConstraints.HORIZONTAL; scanPathsPanelConstraints.gridx = 0; scanPathsPanelConstraints.gridy = 0; scanPathsPanelConstraints.weightx = 1.0; scanPathsPanelConstraints.weighty = 1.0; scanPathsPanelConstraints.gridheight = 1; scanPathsPanelConstraints.gridwidth = 2; scanPathsPanelConstraints.insets = new Insets(5, 5, 5, 5); scanPathsPanel.setBorder(pathsPanelBorder); this.add(scanPathsPanel, scanPathsPanelConstraints); GridBagConstraints sourcePathFieldConstraints = new GridBagConstraints(); sourcePathFieldConstraints.anchor = GridBagConstraints.NORTH; sourcePathFieldConstraints.fill = GridBagConstraints.HORIZONTAL; sourcePathFieldConstraints.gridx = 0; sourcePathFieldConstraints.gridy = 0; sourcePathFieldConstraints.weightx = 1.0; sourcePathFieldConstraints.weighty = 1.0; sourcePathFieldConstraints.gridheight = 1; sourcePathFieldConstraints.gridwidth = 1; sourcePathFieldConstraints.insets = new Insets(0, 5, 5, 5); GridBagConstraints targetPathFieldConstraints = new GridBagConstraints(); targetPathFieldConstraints.anchor = GridBagConstraints.NORTH; targetPathFieldConstraints.fill = GridBagConstraints.HORIZONTAL; targetPathFieldConstraints.gridx = 0; targetPathFieldConstraints.gridy = 1; targetPathFieldConstraints.weightx = 1.0; targetPathFieldConstraints.weighty = 1.0; targetPathFieldConstraints.gridheight = 1; targetPathFieldConstraints.gridwidth = 1; targetPathFieldConstraints.insets = new Insets(5, 5, 5, 5); scanPathsPanel.add(this.sourcePathPickerField, sourcePathFieldConstraints); scanPathsPanel.add(this.targetPathPickerField, targetPathFieldConstraints); if (mappingDefinition != null) { File source = mappingDefinition.getSource(); if (source != null) { this.sourcePathPickerField.setValue(source.getPath()); } else { this.sourcePathPickerField.setValue(""); } File target = mappingDefinition.getTarget(); if (target != null) { this.targetPathPickerField.setValue(target.getPath()); } else { this.targetPathPickerField.setValue(""); } } Border existingExclusionsPanelBorder = BorderFactory.createEtchedBorder(EtchedBorder.LOWERED); existingExclusionsPanelBorder = BorderFactory.createTitledBorder(existingExclusionsPanelBorder, "Exclusions", TitledBorder.CENTER, TitledBorder.TOP); GridBagConstraints existingExclusionsPanelConstraints = new GridBagConstraints(); existingExclusionsPanelConstraints.anchor = GridBagConstraints.WEST; existingExclusionsPanelConstraints.fill = GridBagConstraints.BOTH; existingExclusionsPanelConstraints.gridx = 0; existingExclusionsPanelConstraints.gridy = 1; existingExclusionsPanelConstraints.weightx = 1.0; existingExclusionsPanelConstraints.weighty = 0.9; existingExclusionsPanelConstraints.gridheight = 1; existingExclusionsPanelConstraints.gridwidth = 2; existingExclusionsPanelConstraints.insets = new Insets(0, 5, 0, 5); JPanel existingExclusionsPanel = new JPanel(); GridBagLayout panelGridbag = new GridBagLayout(); existingExclusionsPanel.setLayout(panelGridbag); existingExclusionsPanel.setBorder(existingExclusionsPanelBorder); this.add(existingExclusionsPanel, existingExclusionsPanelConstraints); GridBagConstraints existingExclusionsListConstraints = new GridBagConstraints(); existingExclusionsListConstraints.anchor = GridBagConstraints.WEST; existingExclusionsListConstraints.fill = GridBagConstraints.BOTH; existingExclusionsListConstraints.gridx = 0; existingExclusionsListConstraints.gridy = 0; existingExclusionsListConstraints.weightx = 1.0; existingExclusionsListConstraints.weighty = 0.9; existingExclusionsListConstraints.gridheight = 1; existingExclusionsListConstraints.gridwidth = 2; existingExclusionsListConstraints.insets = new Insets(5, 5, 5, 5); this.mappingDefinition = (ScanMappingDefinition) ModelUtils.initializeEntity(this.mappingDefinition, ScanMappingDefinition.EXCLUSIONS_PROPERTY); this.exclusionsPanel = new ListInputPanel<FileReference>(this.mappingDefinition, this); existingExclusionsPanel.add(this.exclusionsPanel, existingExclusionsListConstraints); this.initialized = true; } }
From source file:gdt.jgui.entity.procedure.JProcedurePanel.java
/** * The default constructor./*from w w w. j ava 2 s . c om*/ */ public JProcedurePanel() { sourcePanel = new JEditorPane(); JScrollPane scrollPaneTop = new JScrollPane(sourcePanel); scrollPaneTop.setBorder(BorderFactory.createTitledBorder(BorderFactory.createEtchedBorder(), "Java Source", TitledBorder.CENTER, TitledBorder.TOP)); reportPanel = new JEditorPane(); JScrollPane scrollPaneBottom = new JScrollPane(reportPanel); scrollPaneBottom.setBorder(BorderFactory.createTitledBorder(BorderFactory.createEtchedBorder(), "Report", TitledBorder.CENTER, TitledBorder.TOP)); setLayout(new BorderLayout(0, 0)); splitPane = new JSplitPane(JSplitPane.VERTICAL_SPLIT, scrollPaneTop, scrollPaneBottom); splitPane.setDividerLocation(0.5); add(splitPane); splitPane.addComponentListener(new ShowListener()); }
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(); }// w ww . j a v a 2s. c om 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:com.digitalgeneralists.assurance.ui.components.FileAttributesPanel.java
private void initializeComponent() { if (!this.initialized) { if (this.file == null) { this.dialogTitle = "No File Provided"; this.file = null; } else {/*from w ww. ja v a 2 s .c o m*/ StringBuilder title = new StringBuilder(128); this.dialogTitle = title.append("Attributes for ").append(file.getFile().getName()).toString(); title.setLength(0); title = null; } GridBagLayout gridbag = new GridBagLayout(); this.setLayout(gridbag); GridBagConstraints filePanelConstraints = new GridBagConstraints(); filePanelConstraints.anchor = GridBagConstraints.NORTH; filePanelConstraints.fill = GridBagConstraints.HORIZONTAL; filePanelConstraints.gridx = 0; filePanelConstraints.gridy = 0; filePanelConstraints.weightx = 1.0; filePanelConstraints.weighty = 0.1; filePanelConstraints.gridheight = 1; filePanelConstraints.gridwidth = 1; filePanelConstraints.insets = new Insets(5, 5, 5, 5); final JPanel filePanel = new JPanel(); filePanel.setLayout(new GridBagLayout()); GridBagConstraints filePathValueConstraints = new GridBagConstraints(); filePathValueConstraints.anchor = GridBagConstraints.WEST; filePathValueConstraints.gridx = 0; filePathValueConstraints.gridy = 0; filePathValueConstraints.weightx = 1.0; filePathValueConstraints.weighty = 1.0; filePathValueConstraints.gridheight = 1; filePathValueConstraints.gridwidth = 1; filePathValueConstraints.insets = new Insets(5, 5, 5, 5); String filePath = "File is null."; if (file != null) { File diskFile = file.getFile(); if (diskFile == null) { filePath = "The disk file is not set."; } else { filePath = diskFile.getPath(); } diskFile = null; } JLabel filePathValue = new JLabel(filePath); filePath = null; filePanel.add(filePathValue, filePathValueConstraints); this.add(filePanel, filePanelConstraints); Border attributesBorder = BorderFactory.createEtchedBorder(EtchedBorder.LOWERED); attributesBorder = BorderFactory.createTitledBorder(attributesBorder, "File Attributes", TitledBorder.CENTER, TitledBorder.TOP); GridBagConstraints attributesPanelConstraints = new GridBagConstraints(); attributesPanelConstraints.anchor = GridBagConstraints.SOUTH; attributesPanelConstraints.fill = GridBagConstraints.BOTH; attributesPanelConstraints.gridx = 0; attributesPanelConstraints.gridy = 1; attributesPanelConstraints.weightx = 1.0; attributesPanelConstraints.weighty = 0.9; attributesPanelConstraints.gridheight = 1; attributesPanelConstraints.gridwidth = 1; attributesPanelConstraints.insets = new Insets(0, 5, 5, 5); JPanel attributesPanel = this.createFileAttributesPanel(file); attributesPanel.setBorder(attributesBorder); this.add(attributesPanel, attributesPanelConstraints); this.initialized = true; } }
From source file:com.digitalgeneralists.assurance.ui.components.ScanDefinitionPanel.java
@Override protected void initializeComponent() { if (!this.initialized) { if (this.definition == null) { mode = AssuranceDialogMode.ADD; this.dialogTitle = "Add New Scan Definition"; this.definition = new ScanDefinition(); } else {//w w w. j a va 2 s.c o m mode = AssuranceDialogMode.EDIT; this.dialogTitle = "Edit Scan Definition"; } GridBagLayout gridbag = new GridBagLayout(); this.setLayout(gridbag); final JPanel optionsPanel = new JPanel(); optionsPanel.setLayout(new GridBagLayout()); Border optionsBorder = BorderFactory.createEtchedBorder(EtchedBorder.LOWERED); optionsBorder = BorderFactory.createTitledBorder(optionsBorder, "Merge Options", TitledBorder.CENTER, TitledBorder.TOP); GridBagConstraints nameTextFieldConstraints = new GridBagConstraints(); nameTextFieldConstraints.anchor = GridBagConstraints.NORTH; nameTextFieldConstraints.fill = GridBagConstraints.HORIZONTAL; nameTextFieldConstraints.gridx = 0; nameTextFieldConstraints.gridy = 0; nameTextFieldConstraints.weightx = 1.0; nameTextFieldConstraints.weighty = 1.0; nameTextFieldConstraints.gridheight = 1; nameTextFieldConstraints.gridwidth = 2; nameTextFieldConstraints.insets = new Insets(10, 5, 0, 5); this.nameTextField.setText(this.definition.getName()); this.nameTextField.getDocument().addDocumentListener(this.textPropertyValidationListener); this.add(this.nameTextField, nameTextFieldConstraints); Border existingScanMappingsPanelBorder = BorderFactory.createEtchedBorder(EtchedBorder.LOWERED); existingScanMappingsPanelBorder = BorderFactory.createTitledBorder(existingScanMappingsPanelBorder, "Paths", TitledBorder.CENTER, TitledBorder.TOP); GridBagConstraints existingScanMappingsPanelConstraints = new GridBagConstraints(); existingScanMappingsPanelConstraints.anchor = GridBagConstraints.WEST; existingScanMappingsPanelConstraints.fill = GridBagConstraints.BOTH; existingScanMappingsPanelConstraints.gridx = 0; existingScanMappingsPanelConstraints.gridy = 1; existingScanMappingsPanelConstraints.weightx = 1.0; existingScanMappingsPanelConstraints.weighty = 1.0; existingScanMappingsPanelConstraints.gridheight = 1; existingScanMappingsPanelConstraints.gridwidth = 2; existingScanMappingsPanelConstraints.insets = new Insets(5, 5, 0, 5); JPanel existingScanMappingsPanel = new JPanel(); GridBagLayout panelGridbag = new GridBagLayout(); existingScanMappingsPanel.setLayout(panelGridbag); existingScanMappingsPanel.setBorder(existingScanMappingsPanelBorder); this.add(existingScanMappingsPanel, existingScanMappingsPanelConstraints); GridBagConstraints existingScanMappingsListConstraints = new GridBagConstraints(); existingScanMappingsListConstraints.anchor = GridBagConstraints.WEST; existingScanMappingsListConstraints.fill = GridBagConstraints.BOTH; existingScanMappingsListConstraints.gridx = 0; existingScanMappingsListConstraints.gridy = 0; existingScanMappingsListConstraints.weightx = 1.0; existingScanMappingsListConstraints.weighty = 0.9; existingScanMappingsListConstraints.gridheight = 1; existingScanMappingsListConstraints.gridwidth = 2; existingScanMappingsListConstraints.insets = new Insets(5, 5, 5, 5); this.definition = (ScanDefinition) ModelUtils.initializeEntity(this.definition, ScanDefinition.SCAN_MAPPING_PROPERTY); this.scanMappingsList = new ListInputPanel<ScanMappingDefinition>(this.definition, this); existingScanMappingsPanel.add(this.scanMappingsList, existingScanMappingsListConstraints); GridBagConstraints optionsPanelConstraints = new GridBagConstraints(); optionsPanelConstraints.anchor = GridBagConstraints.SOUTH; optionsPanelConstraints.fill = GridBagConstraints.HORIZONTAL; optionsPanelConstraints.gridx = 0; optionsPanelConstraints.gridy = 3; optionsPanelConstraints.weightx = 1.0; optionsPanelConstraints.weighty = 1.0; optionsPanelConstraints.gridheight = 1; optionsPanelConstraints.gridwidth = 2; optionsPanelConstraints.insets = new Insets(5, 5, 5, 5); optionsPanel.setBorder(optionsBorder); this.add(optionsPanel, optionsPanelConstraints); GridBagConstraints strategyLabelConstraints = new GridBagConstraints(); strategyLabelConstraints.anchor = GridBagConstraints.WEST; strategyLabelConstraints.fill = GridBagConstraints.BOTH; strategyLabelConstraints.gridx = 0; strategyLabelConstraints.gridy = 0; strategyLabelConstraints.weightx = 1.0; strategyLabelConstraints.weighty = 1.0; strategyLabelConstraints.gridheight = 1; strategyLabelConstraints.gridwidth = 1; strategyLabelConstraints.insets = new Insets(5, 5, 0, 5); final JLabel strategyLabel = new JLabel("Strategy", SwingConstants.RIGHT); optionsPanel.add(strategyLabel, strategyLabelConstraints); GridBagConstraints strategyComboBoxConstraints = new GridBagConstraints(); strategyComboBoxConstraints.anchor = GridBagConstraints.WEST; strategyComboBoxConstraints.fill = GridBagConstraints.VERTICAL; strategyComboBoxConstraints.gridx = 1; strategyComboBoxConstraints.gridy = 0; strategyComboBoxConstraints.weightx = 1.0; strategyComboBoxConstraints.weighty = 1.0; strategyComboBoxConstraints.gridheight = 1; strategyComboBoxConstraints.gridwidth = 1; strategyComboBoxConstraints.insets = new Insets(5, 5, 0, 5); String[] strategyLabels = { "Source", "Target", "Both" }; this.strategyComboBox = new JComboBox<String>(strategyLabels); // NOTE: We should have better validation of the data state for these controls. // We could run into problems as the application versions over time. this.strategyComboBox.setSelectedIndex(this.definition.getMergeStrategy().ordinal()); this.strategyComboBox.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { validateFormState(); } }); optionsPanel.add(this.strategyComboBox, strategyComboBoxConstraints); GridBagConstraints autoMergeCheckBoxConstraints = new GridBagConstraints(); autoMergeCheckBoxConstraints.gridx = 0; autoMergeCheckBoxConstraints.gridy = 1; autoMergeCheckBoxConstraints.weightx = 1.0; autoMergeCheckBoxConstraints.weighty = 1.0; autoMergeCheckBoxConstraints.gridheight = 1; autoMergeCheckBoxConstraints.gridwidth = 2; autoMergeCheckBoxConstraints.insets = new Insets(2, 5, 5, 5); this.autoMergeCheckBox.setHorizontalTextPosition(SwingConstants.LEFT); this.autoMergeCheckBox.setSelected(this.definition.getAutoResolveConflicts()); this.autoMergeCheckBox.addItemListener(new ItemListener() { public void itemStateChanged(ItemEvent e) { validateFormState(); } }); optionsPanel.add(this.autoMergeCheckBox, autoMergeCheckBoxConstraints); GridBagConstraints includeNonCreationTimestampsCheckBoxConstraints = new GridBagConstraints(); includeNonCreationTimestampsCheckBoxConstraints.gridx = 0; includeNonCreationTimestampsCheckBoxConstraints.gridy = 2; includeNonCreationTimestampsCheckBoxConstraints.weightx = 1.0; includeNonCreationTimestampsCheckBoxConstraints.weighty = 1.0; includeNonCreationTimestampsCheckBoxConstraints.gridheight = 1; includeNonCreationTimestampsCheckBoxConstraints.gridwidth = 2; includeNonCreationTimestampsCheckBoxConstraints.insets = new Insets(2, 5, 5, 5); this.includeNonCreationTimestampCheckBox.setHorizontalTextPosition(SwingConstants.LEFT); this.includeNonCreationTimestampCheckBox.setSelected(this.definition.getIncludeNonCreationTimestamps()); this.includeNonCreationTimestampCheckBox.addItemListener(new ItemListener() { public void itemStateChanged(ItemEvent e) { validateFormState(); } }); optionsPanel.add(this.includeNonCreationTimestampCheckBox, includeNonCreationTimestampsCheckBoxConstraints); GridBagConstraints advancedAttributesCheckBoxConstraints = new GridBagConstraints(); advancedAttributesCheckBoxConstraints.gridx = 0; advancedAttributesCheckBoxConstraints.gridy = 3; advancedAttributesCheckBoxConstraints.weightx = 1.0; advancedAttributesCheckBoxConstraints.weighty = 1.0; advancedAttributesCheckBoxConstraints.gridheight = 1; advancedAttributesCheckBoxConstraints.gridwidth = 2; advancedAttributesCheckBoxConstraints.insets = new Insets(2, 5, 5, 5); this.includeAdvancedAttributesCheckBox.setHorizontalTextPosition(SwingConstants.LEFT); this.includeAdvancedAttributesCheckBox.setSelected(this.definition.getAutoResolveConflicts()); this.includeAdvancedAttributesCheckBox.addItemListener(new ItemListener() { public void itemStateChanged(ItemEvent e) { validateFormState(); } }); optionsPanel.add(this.includeAdvancedAttributesCheckBox, advancedAttributesCheckBoxConstraints); this.scanMappingsList.loadData(); if (this.getMode() == AssuranceDialogMode.EDIT) { this.validateFormState(); } this.initialized = true; } }
From source file:com.floreantpos.ui.views.SwitchboardView.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.final DataUpdateInfo *///from w w w . j a v a 2s . c o m // <editor-fold defaultstate="collapsed" desc=" Generated Code // <editor-fold defaultstate="collapsed" // desc=" Generated Code ">//GEN-BEGIN:initComponents private void initComponents() { setLayout(new java.awt.BorderLayout(10, 10)); javax.swing.JPanel centerPanel = new javax.swing.JPanel(new java.awt.BorderLayout(5, 5)); javax.swing.JPanel ticketsAndActivityPanel = new javax.swing.JPanel(new java.awt.BorderLayout(5, 5)); ticketsListPanelBorder = BorderFactory.createTitledBorder(null, POSConstants.OPEN_TICKETS_AND_ACTIVITY, TitledBorder.CENTER, TitledBorder.DEFAULT_POSITION); ticketsAndActivityPanel.setBorder(new CompoundBorder(ticketsListPanelBorder, new EmptyBorder(2, 2, 2, 2))); ticketsAndActivityPanel.add(ticketList, java.awt.BorderLayout.CENTER); JPanel activityPanel = createActivityPanel(); ticketsAndActivityPanel.add(activityPanel, java.awt.BorderLayout.SOUTH); btnAssignDriver.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { doAssignDriver(); } }); btnCloseOrder.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { doCloseOrder(); } }); centerPanel.add(ticketsAndActivityPanel, java.awt.BorderLayout.CENTER); JPanel rightPanel = new JPanel(new BorderLayout(20, 20)); TitledBorder titledBorder2 = BorderFactory.createTitledBorder(null, "-", TitledBorder.CENTER, //$NON-NLS-1$ TitledBorder.DEFAULT_POSITION); rightPanel.setBorder(new CompoundBorder(titledBorder2, new EmptyBorder(2, 2, 6, 2))); orderPanel = new JPanel(new MigLayout("ins 2 2 0 2, fill, hidemode 3, flowy", "fill, grow", "")); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ rendererOrderPanel(); rightPanel.add(orderPanel); rightPanel.setMinimumSize(PosUIManager.getSize(120, 0)); centerPanel.add(rightPanel, java.awt.BorderLayout.EAST); add(centerPanel, java.awt.BorderLayout.CENTER); }
From source file:JXButtonPanel.java
private JPanel createButtonJXButtonPanel() { JPanel ret = new JPanel(new BorderLayout()); JLabel label = new JLabel("Does JXButtonPanel support arrow keys ?"); label.setBorder(BorderFactory.createEmptyBorder(0, 0, 10, 0)); JPanel temp = new JPanel(); temp.add(label);// w ww . j ava2s .co m ret.add(temp); JXButtonPanel panel = new JXButtonPanel(); panel.setCyclic(true); panel.add(new JButton("Yes")); panel.add(new JButton("Sure")); panel.add(new JButton("Absolutely !")); panel.setBorder(BorderFactory.createTitledBorder(null, "JXButtonPanel.setCyclic(true)", TitledBorder.CENTER, TitledBorder.BOTTOM)); ret.setBorder(BorderFactory.createEmptyBorder(10, 0, 10, 0)); ret.add(panel, BorderLayout.SOUTH); return ret; }