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:net.rptools.maptool.client.ui.MapToolFrame.java
public MapToolFrame(JMenuBar menuBar) { // Set up the frame super(AppConstants.APP_NAME); this.menuBar = menuBar; setDefaultCloseOperation(DO_NOTHING_ON_CLOSE); addWindowListener(this); setSize(WINDOW_WIDTH, WINDOW_HEIGHT); SwingUtil.centerOnScreen(this); setFocusTraversalPolicy(new MapToolFocusTraversalPolicy()); try {//from w ww. j av a 2 s . co m setIconImage(ImageUtil.getImage(MINILOGO_IMAGE)); } catch (IOException ioe) { String msg = I18N.getText("msg.error.loadingIconImage"); log.error(msg, ioe); System.err.println(msg); } // Notify duration initializeNotifyDuration(); // Components glassPane = new GlassPane(); assetPanel = createAssetPanel(); connectionPanel = createConnectionPanel(); toolbox = new Toolbox(); initiativePanel = createInitiativePanel(); zoneRendererList = new CopyOnWriteArrayList<ZoneRenderer>(); pointerOverlay = new PointerOverlay(); colorPicker = new ColorPicker(this); textureChooserPanel = new TextureChooserPanel(colorPicker.getPaintChooser(), assetPanel.getModel(), "imageExplorerTextureChooser"); colorPicker.getPaintChooser().addPaintChooser(textureChooserPanel); String credits = ""; String version = ""; Image logo = null; try { credits = new String(FileUtil.loadResource(CREDITS_HTML), "UTF-8"); // 2nd param of type Charset is Java6+ version = MapTool.getVersion(); credits = credits.replace("%VERSION%", version); logo = ImageUtil.getImage(MAPTOOL_LOGO_IMAGE); } catch (Exception ioe) { log.error(I18N.getText("msg.error.credits"), ioe); ioe.printStackTrace(); } aboutDialog = new AboutDialog(this, logo, credits); aboutDialog.setSize(354, 400); statusPanel = new StatusPanel(); statusPanel.addPanel(getCoordinateStatusBar()); statusPanel.addPanel(getZoomStatusBar()); statusPanel.addPanel(MemoryStatusBar.getInstance()); // statusPanel.addPanel(progressBar); statusPanel.addPanel(connectionStatusPanel); statusPanel.addPanel(activityMonitor); statusPanel.addPanel(new SpacerStatusBar(25)); zoneMiniMapPanel = new ZoneMiniMapPanel(); zoneMiniMapPanel.setSize(100, 100); zoneRendererPanel = new JPanel(new PositionalLayout(5)); zoneRendererPanel.setBackground(Color.black); // zoneRendererPanel.add(zoneMiniMapPanel, PositionalLayout.Position.SE); // zoneRendererPanel.add(getChatTypingLabel(), PositionalLayout.Position.NW); zoneRendererPanel.add(getChatTypingPanel(), PositionalLayout.Position.NW); zoneRendererPanel.add(getChatActionLabel(), PositionalLayout.Position.SW); commandPanel = new CommandPanel(); MapTool.getMessageList().addObserver(commandPanel); rendererBorderPanel = new JPanel(new GridLayout()); rendererBorderPanel.setBorder(BorderFactory.createLineBorder(Color.darkGray)); rendererBorderPanel.add(zoneRendererPanel); // Put it all together setJMenuBar(menuBar); add(BorderLayout.NORTH, new ToolbarPanel(toolbox)); add(BorderLayout.SOUTH, statusPanel); JLayeredPane glassPaneComposite = new JLayeredPane(); glassPaneComposite.setLayout(new GridBagLayout()); GridBagConstraints constraints = new GridBagConstraints(); constraints.gridx = 1; constraints.gridy = 1; constraints.fill = GridBagConstraints.BOTH; constraints.weightx = 1; constraints.weighty = 1; glassPaneComposite.add(glassPane, constraints); glassPaneComposite.add(dragImageGlassPane, constraints); setGlassPane(glassPane); // setGlassPane(glassPaneComposite); glassPaneComposite.setVisible(true); if (!MapTool.MAC_OS_X) removeWindowsF10(); else registerForMacOSXEvents(); MapTool.getEventDispatcher().addListener(this, MapTool.ZoneEvent.Activated); restorePreferences(); updateKeyStrokes(); // This will cause the frame to be set to visible (BAD jide, BAD! No cookie for you!) configureDocking(); new WindowPreferences(AppConstants.APP_NAME, "mainFrame", this); chatTyperObserver = new ChatTyperObserver(); chatTyperTimers = new ChatNotificationTimers(); chatTyperTimers.addObserver(chatTyperObserver); chatTimer = getChatTimer(); setChatTypingLabelColor(AppPreferences.getChatNotificationColor()); }
From source file:org.jets3t.gui.ItemPropertiesDialog.java
/** * Initialise the GUI elements to display the given item. * * @param s3Item/*w w w . ja v a2 s .co m*/ * the S3Bucket or an S3Object whose details will be displayed */ private void initGui(boolean isObjectBased) { // Initialise skins factory. skinsFactory = SkinsFactory.getInstance(applicationProperties); // Set Skinned Look and Feel. LookAndFeel lookAndFeel = skinsFactory.createSkinnedMetalTheme("SkinnedLookAndFeel"); try { UIManager.setLookAndFeel(lookAndFeel); } catch (UnsupportedLookAndFeelException e) { log.error("Unable to set skinned LookAndFeel", e); } this.setResizable(true); this.setDefaultCloseOperation(JDialog.DISPOSE_ON_CLOSE); JPanel commonPropertiesContainer = skinsFactory.createSkinnedJPanel("ItemPropertiesCommonPanel"); commonPropertiesContainer.setLayout(new GridBagLayout()); JPanel metadataContainer = skinsFactory.createSkinnedJPanel("ItemPropertiesMetadataPanel"); metadataContainer.setLayout(new GridBagLayout()); JPanel grantsContainer = skinsFactory.createSkinnedJPanel("ItemPropertiesGrantsPanel"); grantsContainer.setLayout(new GridBagLayout()); if (!isObjectBased) { // Display bucket details. JLabel bucketNameLabel = skinsFactory.createSkinnedJHtmlLabel("BucketNameLabel"); bucketNameLabel.setText("Bucket name:"); bucketNameTextField = skinsFactory.createSkinnedJTextField("BucketNameTextField"); bucketNameTextField.setEditable(false); JLabel bucketLocationLabel = skinsFactory.createSkinnedJHtmlLabel("BucketLocationLabel"); bucketLocationLabel.setText("Location:"); bucketLocationTextField = skinsFactory.createSkinnedJTextField("BucketLocationTextField"); bucketLocationTextField.setEditable(false); JLabel bucketCreationDateLabel = skinsFactory.createSkinnedJHtmlLabel("BucketCreationDateLabel"); bucketCreationDateLabel.setText("Creation date:"); bucketCreationDateTextField = skinsFactory.createSkinnedJTextField("BucketCreationDateTextField"); bucketCreationDateTextField.setEditable(false); ownerNameLabel = skinsFactory.createSkinnedJHtmlLabel("OwnerNameLabel"); ownerNameLabel.setText("Owner name:"); ownerNameTextField = skinsFactory.createSkinnedJTextField("OwnerNameTextField"); ownerNameTextField.setEditable(false); ownerIdLabel = skinsFactory.createSkinnedJHtmlLabel("OwnerIdLabel"); ownerIdLabel.setText("Owner ID:"); ownerIdTextField = skinsFactory.createSkinnedJTextField("OwnerIdTextField"); ownerIdTextField.setEditable(false); bucketIsRequesterPaysLabel = skinsFactory.createSkinnedJHtmlLabel("BucketIsRequesterPaysLabel"); bucketIsRequesterPaysLabel.setText("Requester Pays?"); bucketIsRequesterPaysCheckBox = skinsFactory.createSkinnedJCheckBox("BucketIsRequesterPaysCheckBox"); bucketIsRequesterPaysCheckBox.setEnabled(false); int row = 0; commonPropertiesContainer.add(bucketNameLabel, new GridBagConstraints(0, row, 1, 1, 0, 0, GridBagConstraints.EAST, GridBagConstraints.NONE, insetsDefault, 0, 0)); commonPropertiesContainer.add(bucketNameTextField, new GridBagConstraints(1, row, 1, 1, 1, 0, GridBagConstraints.CENTER, GridBagConstraints.HORIZONTAL, insetsDefault, 0, 0)); commonPropertiesContainer.add(bucketLocationLabel, new GridBagConstraints(0, ++row, 1, 1, 0, 0, GridBagConstraints.EAST, GridBagConstraints.NONE, insetsDefault, 0, 0)); commonPropertiesContainer.add(bucketLocationTextField, new GridBagConstraints(1, row, 1, 1, 1, 0, GridBagConstraints.CENTER, GridBagConstraints.HORIZONTAL, insetsDefault, 0, 0)); commonPropertiesContainer.add(bucketCreationDateLabel, new GridBagConstraints(0, ++row, 1, 1, 0, 0, GridBagConstraints.EAST, GridBagConstraints.NONE, insetsDefault, 0, 0)); commonPropertiesContainer.add(bucketCreationDateTextField, new GridBagConstraints(1, row, 1, 1, 1, 0, GridBagConstraints.CENTER, GridBagConstraints.HORIZONTAL, insetsDefault, 0, 0)); commonPropertiesContainer.add(bucketIsRequesterPaysLabel, new GridBagConstraints(0, ++row, 1, 1, 0, 0, GridBagConstraints.EAST, GridBagConstraints.NONE, insetsDefault, 0, 0)); commonPropertiesContainer.add(bucketIsRequesterPaysCheckBox, new GridBagConstraints(1, row, 1, 1, 0, 0, GridBagConstraints.WEST, GridBagConstraints.NONE, insetsDefault, 0, 0)); commonPropertiesContainer.add(ownerNameLabel, new GridBagConstraints(0, ++row, 1, 1, 0, 0, GridBagConstraints.EAST, GridBagConstraints.NONE, insetsDefault, 0, 0)); commonPropertiesContainer.add(ownerNameTextField, new GridBagConstraints(1, row, 1, 1, 1, 0, GridBagConstraints.CENTER, GridBagConstraints.HORIZONTAL, insetsDefault, 0, 0)); commonPropertiesContainer.add(ownerIdLabel, new GridBagConstraints(0, ++row, 1, 1, 0, 0, GridBagConstraints.EAST, GridBagConstraints.NONE, insetsDefault, 0, 0)); commonPropertiesContainer.add(ownerIdTextField, new GridBagConstraints(1, row, 1, 1, 1, 0, GridBagConstraints.CENTER, GridBagConstraints.HORIZONTAL, insetsDefault, 0, 0)); } else { // Display object details. JLabel objectKeyLabel = skinsFactory.createSkinnedJHtmlLabel("ObjectKeyLabel"); objectKeyLabel.setText("Object key:"); objectKeyTextField = skinsFactory.createSkinnedJTextField("ObjectKeyTextField"); objectKeyTextField.setEditable(false); JLabel objectContentTypeLabel = skinsFactory.createSkinnedJHtmlLabel("ContentTypeLabel"); objectContentTypeLabel.setText("Content type:"); objectContentTypeTextField = skinsFactory.createSkinnedJTextField("ContentTypeTextField"); objectContentTypeTextField.setEditable(false); JLabel objectContentLengthLabel = skinsFactory.createSkinnedJHtmlLabel("ObjectContentLengthLabel"); objectContentLengthLabel.setText("Size:"); objectContentLengthTextField = skinsFactory.createSkinnedJTextField("ObjectContentLengthTextField"); objectContentLengthTextField.setEditable(false); JLabel objectLastModifiedLabel = skinsFactory.createSkinnedJHtmlLabel("ObjectLastModifiedLabel"); objectLastModifiedLabel.setText("Last modified:"); objectLastModifiedTextField = skinsFactory.createSkinnedJTextField("ObjectLastModifiedTextField"); objectLastModifiedTextField.setEditable(false); JLabel objectETagLabel = skinsFactory.createSkinnedJHtmlLabel("ObjectETagLabel"); objectETagLabel.setText("ETag:"); objectETagTextField = skinsFactory.createSkinnedJTextField("ObjectETagTextField"); objectETagTextField.setEditable(false); JLabel bucketNameLabel = skinsFactory.createSkinnedJHtmlLabel("BucketNameLabel"); bucketNameLabel.setText("Bucket name:"); bucketNameTextField = skinsFactory.createSkinnedJTextField("BucketNameTextField"); bucketNameTextField.setEditable(false); ownerNameLabel = skinsFactory.createSkinnedJHtmlLabel("OwnerNameLabel"); ownerNameLabel.setText("Owner name:"); ownerNameTextField = skinsFactory.createSkinnedJTextField("OwnerNameTextField"); ownerNameTextField.setEditable(false); ownerIdLabel = skinsFactory.createSkinnedJHtmlLabel("OwnerIdLabel"); ownerIdLabel.setText("Owner ID:"); ownerIdTextField = skinsFactory.createSkinnedJTextField("OwnerIdTextField"); ownerIdTextField.setEditable(false); commonPropertiesContainer.add(objectKeyLabel, new GridBagConstraints(0, 0, 1, 1, 0, 0, GridBagConstraints.EAST, GridBagConstraints.NONE, insetsDefault, 0, 0)); commonPropertiesContainer.add(objectKeyTextField, new GridBagConstraints(1, 0, 1, 1, 1, 0, GridBagConstraints.CENTER, GridBagConstraints.HORIZONTAL, insetsDefault, 0, 0)); commonPropertiesContainer.add(objectContentTypeLabel, new GridBagConstraints(0, 1, 1, 1, 0, 0, GridBagConstraints.EAST, GridBagConstraints.NONE, insetsDefault, 0, 0)); commonPropertiesContainer.add(objectContentTypeTextField, new GridBagConstraints(1, 1, 1, 1, 1, 0, GridBagConstraints.CENTER, GridBagConstraints.HORIZONTAL, insetsDefault, 0, 0)); commonPropertiesContainer.add(objectContentLengthLabel, new GridBagConstraints(0, 2, 1, 1, 0, 0, GridBagConstraints.EAST, GridBagConstraints.NONE, insetsDefault, 0, 0)); commonPropertiesContainer.add(objectContentLengthTextField, new GridBagConstraints(1, 2, 1, 1, 1, 0, GridBagConstraints.CENTER, GridBagConstraints.HORIZONTAL, insetsDefault, 0, 0)); commonPropertiesContainer.add(objectLastModifiedLabel, new GridBagConstraints(0, 3, 1, 1, 0, 0, GridBagConstraints.EAST, GridBagConstraints.NONE, insetsDefault, 0, 0)); commonPropertiesContainer.add(objectLastModifiedTextField, new GridBagConstraints(1, 3, 1, 1, 1, 0, GridBagConstraints.CENTER, GridBagConstraints.HORIZONTAL, insetsDefault, 0, 0)); commonPropertiesContainer.add(objectETagLabel, new GridBagConstraints(0, 4, 1, 1, 0, 0, GridBagConstraints.EAST, GridBagConstraints.NONE, insetsDefault, 0, 0)); commonPropertiesContainer.add(objectETagTextField, new GridBagConstraints(1, 4, 1, 1, 1, 0, GridBagConstraints.CENTER, GridBagConstraints.HORIZONTAL, insetsDefault, 0, 0)); commonPropertiesContainer.add(bucketNameLabel, new GridBagConstraints(0, 5, 1, 1, 0, 0, GridBagConstraints.EAST, GridBagConstraints.NONE, insetsDefault, 0, 0)); commonPropertiesContainer.add(bucketNameTextField, new GridBagConstraints(1, 5, 1, 1, 1, 0, GridBagConstraints.CENTER, GridBagConstraints.HORIZONTAL, insetsDefault, 0, 0)); commonPropertiesContainer.add(ownerNameLabel, new GridBagConstraints(0, 7, 1, 1, 0, 0, GridBagConstraints.EAST, GridBagConstraints.NONE, insetsDefault, 0, 0)); commonPropertiesContainer.add(ownerNameTextField, new GridBagConstraints(1, 7, 1, 1, 1, 0, GridBagConstraints.CENTER, GridBagConstraints.HORIZONTAL, insetsDefault, 0, 0)); commonPropertiesContainer.add(ownerIdLabel, new GridBagConstraints(0, 8, 1, 1, 0, 0, GridBagConstraints.EAST, GridBagConstraints.NONE, insetsDefault, 0, 0)); commonPropertiesContainer.add(ownerIdTextField, new GridBagConstraints(1, 8, 1, 1, 1, 0, GridBagConstraints.CENTER, GridBagConstraints.HORIZONTAL, insetsDefault, 0, 0)); // Build metadata table. objectMetadataTableModel = new DefaultTableModel(new Object[] { "Name", "Value" }, 0) { private static final long serialVersionUID = -3762866886166776851L; @Override public boolean isCellEditable(int row, int column) { return false; } }; TableSorter metadataTableSorter = new TableSorter(objectMetadataTableModel); JTable metadataTable = skinsFactory.createSkinnedJTable("MetadataTable"); metadataTable.setModel(metadataTableSorter); metadataTableSorter.setTableHeader(metadataTable.getTableHeader()); metadataContainer.add(new JScrollPane(metadataTable), new GridBagConstraints(0, 0, 1, 1, 1, 1, GridBagConstraints.CENTER, GridBagConstraints.BOTH, insetsDefault, 0, 0)); } // Build grants table. grantsTableModel = new DefaultTableModel(new Object[] { "Grantee", "Permission" }, 0) { private static final long serialVersionUID = -5882427163845726770L; @Override public boolean isCellEditable(int row, int column) { return false; } }; TableSorter grantsTableSorter = new TableSorter(grantsTableModel); grantsTable = skinsFactory.createSkinnedJTable("GrantsTable"); grantsTable.setModel(grantsTableSorter); grantsTableSorter.setTableHeader(grantsTable.getTableHeader()); grantsContainer.add(new JScrollPane(grantsTable), new GridBagConstraints(0, 0, 1, 1, 1, 1, GridBagConstraints.CENTER, GridBagConstraints.BOTH, insetsDefault, 0, 0)); // OK Button. JButton okButton = skinsFactory.createSkinnedJButton("ItemPropertiesOKButton"); okButton.setText("Finished"); okButton.setActionCommand("OK"); okButton.addActionListener(this); // Set default ENTER button. this.getRootPane().setDefaultButton(okButton); // Put it all together. int row = 0; JPanel container = skinsFactory.createSkinnedJPanel("ItemPropertiesPanel"); container.setLayout(new GridBagLayout()); container.add(commonPropertiesContainer, new GridBagConstraints(0, row++, 1, 1, 1, 0, GridBagConstraints.CENTER, GridBagConstraints.HORIZONTAL, insetsZero, 0, 0)); if (isObjectBased) { if (includeMetadata) { JHtmlLabel metadataLabel = skinsFactory.createSkinnedJHtmlLabel("MetadataLabel"); metadataLabel.setText("<html><b>Metadata</b></html>"); metadataLabel.setHorizontalAlignment(JLabel.CENTER); container.add(metadataLabel, new GridBagConstraints(0, row++, 1, 1, 1, 0, GridBagConstraints.CENTER, GridBagConstraints.HORIZONTAL, insetsVerticalSpace, 0, 0)); container.add(metadataContainer, new GridBagConstraints(0, row++, 1, 1, 1, 1, GridBagConstraints.CENTER, GridBagConstraints.BOTH, insetsZero, 0, 0)); } // Object previous and next buttons, if we have multiple objects. previousObjectButton = skinsFactory.createSkinnedJButton("ItemPropertiesPreviousButton"); previousObjectButton.setText("Previous"); previousObjectButton.addActionListener(this); previousObjectButton.setEnabled(false); nextObjectButton = skinsFactory.createSkinnedJButton("ItemPropertiesNextButton"); nextObjectButton.setText("Next"); nextObjectButton.addActionListener(this); nextObjectButton.setEnabled(false); currentObjectLabel = skinsFactory.createSkinnedJHtmlLabel("ItemPropertiesCurrentObjectLabel"); currentObjectLabel.setHorizontalAlignment(JLabel.CENTER); nextPreviousPanel = skinsFactory.createSkinnedJPanel("ItemPropertiesNextPreviousPanel"); nextPreviousPanel.setLayout(new GridBagLayout()); nextPreviousPanel.add(previousObjectButton, new GridBagConstraints(0, 0, 1, 1, 0, 0, GridBagConstraints.WEST, GridBagConstraints.NONE, insetsZero, 0, 0)); nextPreviousPanel.add(currentObjectLabel, new GridBagConstraints(1, 0, 1, 1, 1, 0, GridBagConstraints.CENTER, GridBagConstraints.HORIZONTAL, insetsZero, 0, 0)); nextPreviousPanel.add(nextObjectButton, new GridBagConstraints(2, 0, 1, 1, 0, 0, GridBagConstraints.EAST, GridBagConstraints.NONE, insetsZero, 0, 0)); container.add(nextPreviousPanel, new GridBagConstraints(0, row, 1, 1, 1, 0, GridBagConstraints.CENTER, GridBagConstraints.HORIZONTAL, insetsZero, 0, 0)); row++; } else { JHtmlLabel grantsLabel = skinsFactory.createSkinnedJHtmlLabel("GrantsLabel"); grantsLabel.setText("<html><b>Permissions</b></html>"); grantsLabel.setHorizontalAlignment(JLabel.CENTER); container.add(grantsLabel, new GridBagConstraints(0, row++, 1, 1, 1, 0, GridBagConstraints.CENTER, GridBagConstraints.HORIZONTAL, insetsVerticalSpace, 0, 0)); container.add(grantsContainer, new GridBagConstraints(0, row++, 1, 1, 1, 1, GridBagConstraints.CENTER, GridBagConstraints.BOTH, insetsZero, 0, 0)); } container.add(okButton, new GridBagConstraints(0, row++, 3, 1, 0, 0, GridBagConstraints.CENTER, GridBagConstraints.NONE, insetsZero, 0, 0)); this.getContentPane().add(container); this.pack(); if (isObjectBased) { this.setSize(400, (includeMetadata ? 550 : 400)); } this.setLocationRelativeTo(this.getOwner()); }
From source file:com.rapidminer.gui.new_plotter.gui.ColorSchemeDialog.java
/** * @param containerPanel/*from w w w . j a v a 2s . c om*/ */ private void createPlotPreviewPanel(JPanel containerPanel) { JPanel previewPanel = new JPanel(new GridBagLayout()); previewPanel.setPreferredSize(new Dimension(300, 300)); GridBagConstraints itemConstraint = new GridBagConstraints(); itemConstraint.fill = GridBagConstraints.BOTH; itemConstraint.weightx = 1; itemConstraint.weighty = 1; itemConstraint.gridwidth = GridBagConstraints.REMAINDER; // nominal value color preview { nominalPreviewPanel = nominalPlotter.getChartPanel(); nominalPreviewPanel.setPreferredSize(new Dimension(150, 150)); previewPanel.add(nominalPreviewPanel, itemConstraint); } // add gradient preview { gradientPreviewPanel = gradientPlotter.getChartPanel(); gradientPreviewPanel.setPreferredSize(new Dimension(150, 150)); previewPanel.add(gradientPreviewPanel, itemConstraint); } itemConstraint = new GridBagConstraints(); itemConstraint.fill = GridBagConstraints.BOTH; itemConstraint.weightx = 1; itemConstraint.weighty = 1; itemConstraint.gridwidth = GridBagConstraints.RELATIVE; containerPanel.add(previewPanel, itemConstraint); }
From source file:org.openconcerto.erp.core.humanresources.payroll.element.VariablePayeSQLElement.java
public SQLComponent createComponent() { return new BaseSQLComponent(this) { private ValidState validVarName; private JRadioButton radioVal = new JRadioButton("Valeur"); private JRadioButton radioFormule = new JRadioButton("Formule"); private final JTextField textValeur = new JTextField(); // private final ITextArea textFormule = new ITextArea(); private final VariableTree treeVariable = new VariableTree(); private final JTextField textNom = new JTextField(); private final JLabel labelWarningBadVar = new JLabelWarning(); private ElementComboBox comboSelSal; private EditFrame edit = null; private final SQLJavaEditor textFormule = new SQLJavaEditor(getMapTree()); public void addViews() { this.setLayout(new GridBagLayout()); final GridBagConstraints c = new DefaultGridBagConstraints(); this.validVarName = null; this.textFormule.setEditable(false); // Arbre des variables JScrollPane sc = new JScrollPane(this.treeVariable); sc.setPreferredSize(new Dimension(150, sc.getPreferredSize().height)); this.treeVariable.addMouseListener(new MouseAdapter() { public void mousePressed(final MouseEvent mE) { if (mE.getButton() == MouseEvent.BUTTON3) { JPopupMenu menuDroit = new JPopupMenu(); TreePath path = treeVariable.getClosestPathForLocation(mE.getPoint().x, mE.getPoint().y); final Object obj = path.getLastPathComponent(); if ((obj == null) || !(obj instanceof VariableRowTreeNode)) { return; }//from w ww . ja va 2 s . c o m menuDroit.add(new AbstractAction("Editer") { public void actionPerformed(ActionEvent e) { if (edit == null) { edit = new EditFrame(getElement(), EditFrame.MODIFICATION); } System.err.println("Action performed"); if (obj != null) { System.err.println("Object not null --> " + obj.toString()); if (obj instanceof VariableRowTreeNode) { System.err.println("Object VariableRowTreeNode"); VariableRowTreeNode varNode = (VariableRowTreeNode) obj; edit.selectionId(varNode.getID(), 1); edit.setVisible(true); } } } }); menuDroit.show((Component) mE.getSource(), mE.getPoint().x, mE.getPoint().y); } else { if (mE.getClickCount() == 2) { TreePath path = treeVariable.getClosestPathForLocation(mE.getPoint().x, mE.getPoint().y); Object obj = path.getLastPathComponent(); if (obj != null) { if (obj instanceof FormuleTreeNode) { final FormuleTreeNode n = (FormuleTreeNode) obj; int start = textFormule.getSelectionStart(); String tmp = textFormule.getText(); textFormule.setText(tmp.substring(0, start) + n.getTextValue() + tmp.substring(start, tmp.length())); } } } } } }); JPanel panelDroite = new JPanel(); panelDroite.setLayout(new GridBagLayout()); // Categorie JTextField textCategorie = new JTextField(); c.fill = GridBagConstraints.HORIZONTAL; c.gridheight = 1; c.gridx = 1; c.gridy = 0; JLabel labelCategorie = new JLabel("Catgorie"); panelDroite.add(labelCategorie, c); c.gridx++; c.gridwidth = GridBagConstraints.REMAINDER; panelDroite.add(textCategorie, c); c.gridwidth = 1; // Nom c.fill = GridBagConstraints.HORIZONTAL; c.gridheight = 1; c.gridx = 1; c.gridy++; JLabel labelNom = new JLabel("Nom"); panelDroite.add(labelNom, c); c.gridx++; c.weightx = 1; panelDroite.add(this.textNom, c); this.textNom.getDocument().addDocumentListener(new SimpleDocumentListener() { @Override public void update(DocumentEvent e) { updateValidVarName(); } }); c.gridx++; c.weightx = 0; panelDroite.add(this.labelWarningBadVar, c); // Description JLabel labelInfos = new JLabel(getLabelFor("INFOS")); ITextArea textInfos = new ITextArea(); c.gridy++; c.gridx = 1; c.gridwidth = 1; c.weightx = 0; panelDroite.add(labelInfos, c); c.gridx++; c.gridwidth = GridBagConstraints.REMAINDER; c.weightx = 1; c.weighty = 0; panelDroite.add(textInfos, c); // Valeur c.gridx = 1; c.gridy++; c.gridwidth = 1; c.weightx = 0; panelDroite.add(this.radioVal, c); c.gridx++; c.weightx = 1; c.gridwidth = GridBagConstraints.REMAINDER; panelDroite.add(this.textValeur, c); c.gridwidth = 1; c.gridx = 1; c.gridy++; panelDroite.add(this.radioFormule, c); c.gridx++; c.weightx = 1; c.weighty = 1; c.fill = GridBagConstraints.BOTH; c.gridwidth = GridBagConstraints.REMAINDER; panelDroite.add(this.textFormule, c); c.gridwidth = 1; ButtonGroup group = new ButtonGroup(); group.add(this.radioVal); group.add(this.radioFormule); this.radioVal.setSelected(true); setFormuleEnabled(false); this.radioVal.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { setFormuleEnabled(false); } }); this.radioFormule.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { setFormuleEnabled(true); } }); c.gridy++; c.gridx = 1; c.weighty = 0; c.weightx = 0; c.fill = GridBagConstraints.HORIZONTAL; this.comboSelSal = new ElementComboBox(false); this.comboSelSal.init(getDirectory().getElement(SalarieSQLElement.class)); c.gridx++; c.gridwidth = GridBagConstraints.REMAINDER; c.weightx = 0; panelDroite.add(this.comboSelSal, c); c.gridwidth = 1; JSplitPane split = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT, sc, panelDroite); c.fill = GridBagConstraints.BOTH; c.gridx = 0; c.gridy = 0; c.weightx = 1; c.weighty = 1; this.add(split, c); this.addRequiredSQLObject(this.textNom, "NOM"); this.addSQLObject(this.textValeur, "VALEUR"); this.addSQLObject(this.textFormule, "FORMULE"); this.addSQLObject(textCategorie, "CATEGORIE"); this.addSQLObject(textInfos, "INFOS"); this.comboSelSal.addValueListener(new PropertyChangeListener() { public void propertyChange(PropertyChangeEvent evt) { // TODO Auto-generated method stub textFormule.setSalarieID(comboSelSal.getSelectedId()); } }); } @Override public synchronized ValidState getValidState() { return super.getValidState().and(this.validVarName); } private void setFormuleEnabled(boolean b) { if (b) { this.textValeur.setText(""); } else { this.textFormule.setText(""); } this.textValeur.setEditable(!b); this.textValeur.setEnabled(!b); this.textFormule.setEditable(b); this.textFormule.setEnabled(b); this.treeVariable.setEnabled(b); this.treeVariable.setEditable(b); } private void setValidVarName(ValidState s) { if (!s.equals(this.validVarName)) { this.validVarName = s; final boolean warningVisible = !s.isValid(); if (warningVisible) this.labelWarningBadVar.setText(s.getValidationText()); this.labelWarningBadVar.setVisible(warningVisible); this.fireValidChange(); } } private void updateValidVarName() { this.setValidVarName(this.computeValidVarName()); } private ValidState computeValidVarName() { // on vrifie si la syntaxe de la variable est correct (chiffre lettre et _) final String varName = this.textNom.getText().trim(); System.err.println("Verification de la validit du nom de la variable."); if (varName.length() == 0) { return VAR_NO_NAME; } // ne contient que des chiffre lettre et _ et ne commence pas par un chiffre if (!isJavaVar(varName)) { return VAR_NAME_NOT_CORRECT; } // on vrifie que la variable n'existe pas dja SQLSelect selAllVarName = new SQLSelect(getTable().getBase()); selAllVarName.addSelect(VariablePayeSQLElement.this.getTable().getField("ID")); Where w = new Where(VariablePayeSQLElement.this.getTable().getField("NOM"), "=", varName); w = w.and(new Where(VariablePayeSQLElement.this.getTable().getKey(), "!=", getSelectedID())); selAllVarName.setWhere(w); String reqAllVarName = selAllVarName.asString();// + " AND '" + varName.trim() + "' // REGEXP VARIABLE_PAYE.NOM"; Object[] objKeysRowName = ((List) getTable().getBase().getDataSource().execute(reqAllVarName, new ArrayListHandler())).toArray(); if (objKeysRowName.length > 0) { return VAR_ALREADY_EXIST; } else { // Impossible de crer une variable du meme nom qu'un champ du salarie if (isForbidden(varName)) return VAR_ALREADY_EXIST; this.textFormule.setVarAssign(varName); return ValidState.getTrueInstance(); } } private boolean isJavaVar(String s) { if ((s.charAt(0) >= '0') && ((s.charAt(0) <= '9'))) { System.err.println("Erreur la variable commence par un chiffre!!"); return false; } else { for (int i = 0; i < s.length(); i++) { if (!(((s.charAt(i) >= '0') && (s.charAt(i) <= '9')) || (s.charAt(i) >= 'a') && (s.charAt(i) <= 'z') || (s.charAt(i) >= 'A') && (s.charAt(i) <= 'Z') || (s.charAt(i) == '_'))) { System.err.println("Erreur la variable contient un caractere incorrect!!"); return false; } } return (!CTokenMarker.getKeywords().isExisting(s)); } } @Override public void select(SQLRowAccessor r) { super.select(r); // System.err.println("Select RowAccess -------> " + r.getID() + " For Object " + // this.hashCode()); if (r != null) { if (r.getString("FORMULE").trim().length() == 0) { this.radioVal.setSelected(true); setFormuleEnabled(false); } else { this.radioFormule.setSelected(true); setFormuleEnabled(true); } this.textFormule.setVarAssign(r.getString("NOM")); } this.updateValidVarName(); } }; }
From source file:br.org.acessobrasil.ases.ferramentas_de_reparo.vista.imagem.analise_geral.PanelAnaliseGeral.java
/** * Inicia os componentes/*from w ww. ja va2s. c om*/ * * @param erros */ private void initComponentsEscalavel(ArrayList<FerramentaAnaliseGeralModel> erros) { incValueProgress(); hashCodeInicial = null; PainelStatusBar.hideProgTarReq(); Ferramenta_Imagens.carregaTexto(TokenLang.LANG); JPanel regraFonteBtn = new JPanel(); regraFonteBtn.setLayout(new BorderLayout()); PainelStatusBar.setValueProgress(3); boxCode = new G_TextAreaSourceCode(); boxCode.setTipoHTML(); incValueProgress(); parentFrame.setJMenuBar(this.criaMenuBar()); PainelStatusBar.setValueProgress(6); // parentFrame.setTitle("Associador de rtulos"); tableLinCod = new TabelaAnaliseGeral(this, erros); arTextPainelCorrecao = new ArTextPainelCorrecao(this); incValueProgress(); // scrollPaneCorrecaoLabel = new ConteudoCorrecaoLabel(); analiseSistematica = new JButton(); salvar = new JButton(); cancelar = new JButton(); salvarMod = new JButton(); salvarPag = new JButton(); aplicarPag = new JButton(); aplicarTod = new JButton(); strConteudoalt = new String(); incValueProgress(); btnSalvar = new JMenuItem(GERAL.BTN_SALVAR); PainelStatusBar.setValueProgress(10); pnRegra = new JPanel(); lbRegras1 = new JLabel(); lbRegras2 = new JLabel(); pnSetaDescricao = new JPanel(); spTextoDescricao = new JScrollPane(); tArParticipRotulo = new TArParticipRotulo(this); conteudoDoAlt = new JTextArea(); pnListaErros = new JPanel(); scrollPanetabLinCod = new JScrollPane(); incValueProgress(); /** * Mostra pro usurio a imagem que est sem descrio */ imagemSemDesc = new XHTMLPanel(); pnBotoes = new JPanel(); salvar.setEnabled(false); // salvaAlteracoes = new SalvaAlteracoes(boxCode.getTextPane(), salvar, // btnSalvar, parentFrame); adicionar = new JButton(); aplicar = new JButton(); conteudoParticRotulo = new ArrayList<String>(); analiseSistematica.setEnabled(false); boxCode.getTextPane().setText(TxtBuffer.getContent()); PainelStatusBar.setValueProgress(20); String fullUrl = this.enderecoImagem; System.out.println("\t\t\t\t\tendereo da imagem: " + fullUrl); SetImage setImage = new SetImage(this, fullUrl); setImage.start(); incValueProgress(); setBackground(CoresDefault.getCorPaineis()); Container contentPane = this;// ?? contentPane.setLayout(new GridLayout(2, 1)); incValueProgress(); // ======== pnRegra ======== { pnRegra.setBorder(criaBorda(Ferramenta_Imagens.TITULO_REGRA)); pnRegra.setLayout(new GridLayout(2, 1)); pnRegra.add(lbRegras1); lbRegras1.setText(Ferramenta_Imagens.REGRAP1); lbRegras2.setText(Ferramenta_Imagens.REGRAP2); lbRegras1.setHorizontalAlignment(SwingConstants.CENTER); lbRegras2.setHorizontalAlignment(SwingConstants.CENTER); pnRegra.add(lbRegras1); pnRegra.add(lbRegras2); pnRegra.setPreferredSize(new Dimension(700, 60)); incValueProgress(); } PainelStatusBar.setValueProgress(30); // G_URLIcon.setIcon(lbTemp, // "http://pitecos.blogs.sapo.pt/arquivo/pai%20natal%20o5.%20jpg.jpg"); JScrollPane sp = new JScrollPane(); sp.setViewportView(imagemSemDesc); sp.setPreferredSize(new Dimension(500, 300)); // ======== pnDescricao ======== incValueProgress(); // ---- Salvar ---- salvarMod.setText(GERAL.SALVAR_MODIFICADAS); salvarMod.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { salvarModificadosActionPerformed(e); } }); incValueProgress(); salvarMod.setToolTipText(GERAL.DICA_SALVAR_MODIFICADOS); salvarMod.getAccessibleContext().setAccessibleDescription(GERAL.DICA_SALVAR_MODIFICADOS); salvarMod.getAccessibleContext().setAccessibleName(GERAL.DICA_SALVAR_MODIFICADOS); salvarMod.setBounds(10, 0, 150, 25); PainelStatusBar.setValueProgress(40); salvarPag.setText(GERAL.SALVAR_ULTIMA); salvarPag.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { salvarPaginaActionPerformed(e); } }); incValueProgress(); salvarPag.setToolTipText(GERAL.DICA_SALVAR_ULTIMA_MODIFICADA); salvarPag.getAccessibleContext().setAccessibleDescription(GERAL.DICA_SALVAR_ULTIMA_MODIFICADA); salvarPag.getAccessibleContext().setAccessibleName(Ferramenta_Imagens.DICA_ABRIR_HTML); salvarPag.setBounds(165, 0, 150, 25); incValueProgress(); salvarMod.setEnabled(false); salvarPag.setEnabled(false); ArrayList<JButton> btnsSalvar = new ArrayList<JButton>(); btnsSalvar.add(salvarMod); btnsSalvar.add(salvarPag); btnsSalvar.add(salvar); salvaAlteracoes = new SalvaAlteracoes(boxCode.getTextPane(), btnsSalvar, btnSalvar, parentFrame); aplicarPag.setText(GERAL.APLICAR_PAGINA); aplicarPag.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { aplicarPaginaActionPerformed(e); } }); incValueProgress(); PainelStatusBar.setValueProgress(50); aplicarPag.setToolTipText(GERAL.DICA_APLICA_PAGINA); aplicarPag.getAccessibleContext().setAccessibleDescription(GERAL.DICA_APLICA_PAGINA); aplicarPag.getAccessibleContext().setAccessibleName(GERAL.DICA_APLICA_PAGINA); aplicarPag.setBounds(320, 0, 150, 25); incValueProgress(); aplicarTod.setText(GERAL.APLICA_TODOS); aplicarTod.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { Thread t = new Thread(new Runnable() { public void run() { aplicarATodosActionPerformed(); } }); t.start(); } }); incValueProgress(); aplicarTod.setToolTipText(GERAL.DICA_APLICA_ULTIMA_TODOS); aplicarTod.getAccessibleContext().setAccessibleDescription(GERAL.DICA_APLICA_ULTIMA_TODOS); aplicarTod.getAccessibleContext().setAccessibleName(GERAL.DICA_APLICA_ULTIMA_TODOS); aplicarTod.setBounds(475, 0, 150, 25); aplicarPag.setEnabled(false); aplicarTod.setEnabled(false); PainelStatusBar.setValueProgress(60); incValueProgress(); cancelar.setText(GERAL.TELA_ANTERIOR); cancelar.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { CancelarActionPerformed(e); } }); cancelar.setToolTipText(Ferramenta_Imagens.DICA_BTN_CANCELAR); cancelar.getAccessibleContext().setAccessibleDescription(Ferramenta_Imagens.DICA_BTN_CANCELAR); cancelar.getAccessibleContext().setAccessibleName(Ferramenta_Imagens.DICA_BTN_CANCELAR); cancelar.setBounds(630, 0, 150, 25); incValueProgress(); pnSetaDescricao.setBorder(criaBorda(Ferramenta_Imagens.TITULO_DIGITE_O_ALT)); GridBagConstraints cons = new GridBagConstraints(); GridBagLayout layout = new GridBagLayout(); cons.fill = GridBagConstraints.BOTH; cons.weighty = 1; cons.weightx = 0.80; PainelStatusBar.setValueProgress(70); incValueProgress(); pnSetaDescricao.setLayout(layout); cons.anchor = GridBagConstraints.SOUTHEAST; cons.insets = new Insets(0, 0, 0, 10); // ======== spParticRotulo ======== conteudoDoAlt.addKeyListener(new KeyListener() { public void keyPressed(KeyEvent arg0) { } public void keyTyped(KeyEvent arg0) { } public void keyReleased(KeyEvent arg0) { if (conteudoDoAlt.getText().length() == 0 || tableLinCod.getNumLinhas() < 1) { System.out.println("conteudo vazio"); aplicarPag.setEnabled(false); aplicarTod.setEnabled(false); } else if (tableLinCod.getSelectedRow() != -1) { System.out.println("com conteudo"); aplicarPag.setEnabled(true); aplicarTod.setEnabled(true); } else { aplicarTod.setEnabled(true); } } }); { spTextoDescricao.setViewportView(conteudoDoAlt); } incValueProgress(); // lbRegras1.setText(Reparo_Imagens.REGRAP2); // lbRegras1.setHorizontalAlignment(SwingConstants.CENTER); // pnRegra.add(lbRegras1); pnSetaDescricao.add(spTextoDescricao, cons); cons.weightx = 0.20; pnSetaDescricao.setPreferredSize(new Dimension(400, 60)); // ======== pnListaErros ======== { PainelStatusBar.setValueProgress(80); pnListaErros.setBorder(criaBorda(Ferramenta_Imagens.LISTA_ERROS)); pnListaErros.setLayout(new BorderLayout()); // ======== scrollPanetabLinCod ======== { scrollPanetabLinCod.setViewportView(tableLinCod); } pnListaErros.add(scrollPanetabLinCod, BorderLayout.CENTER); } // ======== pnBotoes ======== incValueProgress(); { // pnBotoes.setBorder(criaBorda("")); pnBotoes.setLayout(null); // ---- adicionar ---- adicionar.setText(Ferramenta_Imagens.BTN_ADICIONAR); adicionar.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { adicionarActionPerformed(e); } }); PainelStatusBar.setValueProgress(90); adicionar.setToolTipText(Ferramenta_Imagens.DICA_ADICIONAR); adicionar.getAccessibleContext().setAccessibleDescription(Ferramenta_Imagens.DICA_ADICIONAR); adicionar.getAccessibleContext().setAccessibleName(Ferramenta_Imagens.DICA_ADICIONAR); adicionar.setBounds(10, 5, 150, 25); // pnBotoes.add(adicionar); incValueProgress(); // ---- aplicarRotulo ---- aplicar.setEnabled(false); aplicar.setText(Ferramenta_Imagens.BTN_APLICAR); aplicar.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { aplicarRotuloActionPerformed(e); } }); incValueProgress(); aplicar.setToolTipText(Ferramenta_Imagens.DICA_APLICAR); aplicar.getAccessibleContext().setAccessibleDescription(Ferramenta_Imagens.DICA_APLICAR); aplicar.getAccessibleContext().setAccessibleName(Ferramenta_Imagens.DICA_APLICAR); aplicar.setBounds(10, 5, 150, 25); // pnBotoes.add(aplicar); } /* * Colocar os controles */ pnRegra.setBackground(CoresDefault.getCorPaineis()); regraFonteBtn.add(pnRegra, BorderLayout.NORTH); boxCode.setBorder(criaBorda("")); boxCode.setBackground(CoresDefault.getCorPaineis()); incValueProgress(); JSplitPane splitPane = null; Dimension minimumSize = new Dimension(0, 0); // JScrollPane ajudaScrollPane = new // JScrollPane(ajuda,JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED,JScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED); PainelStatusBar.setValueProgress(93); sp.setMinimumSize(minimumSize); sp.setPreferredSize(new Dimension(150, 90)); splitPane = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT, sp, boxCode); splitPane.setOneTouchExpandable(true); // splitPane.set // splitPane.setDividerLocation(0.95); int w = parentFrame.getWidth(); int s = w / 4; splitPane.setDividerLocation(s); incValueProgress(); // regraFonteBtn.add(scrollPaneCorrecaoLabel, BorderLayout.CENTER); regraFonteBtn.add(splitPane, BorderLayout.CENTER); pnBotoes.setPreferredSize(new Dimension(600, 35)); pnBotoes.setBackground(CoresDefault.getCorPaineis()); // regraFonteBtn.add(pnBotoes, BorderLayout.SOUTH); regraFonteBtn.setBackground(CoresDefault.getCorPaineis()); contentPane.add(regraFonteBtn); PainelStatusBar.setValueProgress(96); JPanel textoErrosBtn = new JPanel(); textoErrosBtn.setLayout(new BorderLayout()); pnSetaDescricao.setBackground(CoresDefault.getCorPaineis()); pnSetaDescricao.add(pnBotoes, cons); textoErrosBtn.add(pnSetaDescricao, BorderLayout.NORTH); textoErrosBtn.add(pnListaErros, BorderLayout.CENTER); JPanel pnSalvarCancelar = new JPanel(); pnSalvarCancelar.setLayout(null); pnSalvarCancelar.setPreferredSize(new Dimension(600, 35)); incValueProgress(); pnSalvarCancelar.add(salvarMod); pnSalvarCancelar.add(salvarPag); pnSalvarCancelar.add(aplicarPag); pnSalvarCancelar.add(aplicarTod); pnSalvarCancelar.add(cancelar); pnSalvarCancelar.setBackground(CoresDefault.getCorPaineis()); incValueProgress(); textoErrosBtn.add(pnSalvarCancelar, BorderLayout.SOUTH); PainelStatusBar.setValueProgress(100); pnListaErros.setBackground(CoresDefault.getCorPaineis()); textoErrosBtn.add(pnListaErros, BorderLayout.CENTER); contentPane.setBackground(CoresDefault.getCorPaineis()); incValueProgress(); contentPane.add(textoErrosBtn); System.out.println("\t\t\t" + TxtBuffer.getContent()); incValueProgress(); this.setVisible(true); }
From source file:com.sec.ose.osi.ui.frm.main.manage.JPanManageMain.java
/** * This method initializes jPanelProjectList * //from ww w .ja v a2s .c om * @return javax.swing.JPanel */ private JPanel getJPanelProjectList() { if (jPanelProjectList == null) { GridBagConstraints gridBagConstraints8 = new GridBagConstraints(); gridBagConstraints8.anchor = GridBagConstraints.EAST; gridBagConstraints8.weightx = 0.1; gridBagConstraints8.insets = new Insets(0, 0, 0, 10); GridBagConstraints gridBagConstraints2 = new GridBagConstraints(); gridBagConstraints2.anchor = GridBagConstraints.CENTER; gridBagConstraints2.insets = new Insets(0, 0, 0, 10); GridBagConstraints gridBagConstraints = new GridBagConstraints(); gridBagConstraints.fill = GridBagConstraints.BOTH; gridBagConstraints.gridy = 1; gridBagConstraints.weightx = 1.0; gridBagConstraints.weighty = 1.0; gridBagConstraints.gridwidth = 3; gridBagConstraints.insets = new Insets(10, 10, 10, 10); gridBagConstraints.gridx = 0; jPanelProjectList = new JPanel(); jPanelProjectList.setLayout(new GridBagLayout()); jPanelProjectList.setBorder(BorderFactory.createTitledBorder(null, "Project", TitledBorder.DEFAULT_JUSTIFICATION, TitledBorder.DEFAULT_POSITION, new Font("Dialog", Font.BOLD, 12), new Color(51, 51, 51))); jPanelProjectList.add(getJButtonAdd(), gridBagConstraints8); jPanelProjectList.add(getJButtonCreate(), gridBagConstraints2); jPanelProjectList.add(getJScrollPanePjtList(), gridBagConstraints); } return jPanelProjectList; }
From source file:com.sec.ose.osi.ui.frm.main.identification.codematch.JPanCodeMatchMain.java
/** * This method initializes jPanel1 /* w ww . ja v a 2 s .c om*/ * * @return javax.swing.JPanel */ public JSplitPane getJSplitPaneSourceCode() { if (jSplitPaneSourceCode == null) { GridBagConstraints gridBagConstraints14 = new GridBagConstraints(); gridBagConstraints14.fill = GridBagConstraints.BOTH; gridBagConstraints14.weighty = 1.0; gridBagConstraints14.weightx = 1.0; GridBagConstraints gridBagConstraints17 = new GridBagConstraints(); gridBagConstraints17.fill = GridBagConstraints.BOTH; gridBagConstraints17.weighty = 1.0; gridBagConstraints17.weightx = 1.0; jSplitPaneSourceCode = new JSplitPane(); jSplitPaneSourceCode.setBorder(BorderFactory.createTitledBorder(null, "Source Code", TitledBorder.DEFAULT_JUSTIFICATION, TitledBorder.DEFAULT_POSITION, new Font("Dialog", Font.BOLD, 12), new Color(51, 51, 51))); jSplitPaneSourceCode.setDividerSize(5); jSplitPaneSourceCode.setLeftComponent(getJPanMatchedSourceViewLeft()); jSplitPaneSourceCode.setRightComponent(getJPanMatchedSourceViewRight()); PropertyChangeListener propertyChangeListener = new PropertyChangeListener() { public void propertyChange(PropertyChangeEvent changeEvent) { String propertyName = changeEvent.getPropertyName(); if (propertyName.equals(JSplitPane.LAST_DIVIDER_LOCATION_PROPERTY)) { if (getSimilarSnippets() != null) { setNavigator(); } } } }; jSplitPaneSourceCode.addPropertyChangeListener(propertyChangeListener); } return jSplitPaneSourceCode; }
From source file:org.openconcerto.erp.core.supplychain.order.component.CommandeSQLComponent.java
public void addViews() { this.setLayout(new GridBagLayout()); final GridBagConstraints c = new DefaultGridBagConstraints(); // Numero du commande c.gridx = 0;//from w ww . j a v a 2 s. c o m c.weightx = 0; this.add(new JLabel(getLabelFor("NUMERO"), SwingConstants.RIGHT), c); this.numeroUniqueCommande = new JUniqueTextField(16); c.gridx++; c.weightx = 1; c.fill = GridBagConstraints.NONE; DefaultGridBagConstraints.lockMinimumSize(numeroUniqueCommande); this.add(this.numeroUniqueCommande, c); // Date JLabel labelDate = new JLabel(getLabelFor("DATE")); labelDate.setHorizontalAlignment(SwingConstants.RIGHT); c.gridx = 2; c.weightx = 0; c.fill = GridBagConstraints.HORIZONTAL; this.add(labelDate, c); JDate dateCommande = new JDate(true); c.gridx++; c.fill = GridBagConstraints.NONE; this.add(dateCommande, c); // Fournisseur c.gridx = 0; c.gridy++; c.weightx = 0; c.fill = GridBagConstraints.HORIZONTAL; this.add(new JLabel(getLabelFor("ID_FOURNISSEUR"), SwingConstants.RIGHT), c); c.gridx = GridBagConstraints.RELATIVE; c.gridwidth = 1; c.weightx = 1; c.weighty = 0; c.fill = GridBagConstraints.NONE; this.add(this.fourn, c); if (!getTable().getFieldsName().contains("LIVRER")) { // Commande en cours JCheckBox boxEnCours = new JCheckBox(getLabelFor("EN_COURS")); c.gridx = 2; c.weightx = 0; c.fill = GridBagConstraints.HORIZONTAL; c.gridwidth = GridBagConstraints.REMAINDER; this.add(boxEnCours, c); c.gridwidth = 1; this.addRequiredSQLObject(boxEnCours, "EN_COURS"); } // Fournisseur if (getTable().contains("ID_CONTACT_FOURNISSEUR")) { c.gridx = 0; c.gridy++; c.weightx = 0; c.fill = GridBagConstraints.HORIZONTAL; this.add(new JLabel(getLabelFor("ID_CONTACT_FOURNISSEUR"), SwingConstants.RIGHT), c); c.gridx = GridBagConstraints.RELATIVE; c.gridwidth = 1; c.weightx = 1; c.weighty = 0; c.fill = GridBagConstraints.HORIZONTAL; final ElementComboBox boxContactFournisseur = new ElementComboBox(); final SQLElement contactElement = Configuration.getInstance().getDirectory() .getElement("CONTACT_FOURNISSEUR"); boxContactFournisseur.init(contactElement, contactElement.getComboRequest(true)); this.add(boxContactFournisseur, c); this.addView(boxContactFournisseur, "ID_CONTACT_FOURNISSEUR", REQ); fourn.addValueListener(new PropertyChangeListener() { @Override public void propertyChange(PropertyChangeEvent arg0) { // TODO Raccord de mthode auto-gnr if (fourn.getSelectedRow() != null) { boxContactFournisseur.getRequest() .setWhere(new Where(contactElement.getTable().getField("ID_FOURNISSEUR"), "=", fourn.getSelectedRow().getID())); } else { boxContactFournisseur.getRequest().setWhere(null); } } }); } // Adresse de livraison if (getTable().getFieldsName().contains("ID_ADRESSE")) { if (getTable().getFieldsName().contains("LIVRAISON_F")) { c.gridx = 0; c.gridy++; c.weightx = 0; c.fill = GridBagConstraints.HORIZONTAL; this.add(new JLabel(getLabelFor("ID_ADRESSE")), c); c.gridx++; c.gridwidth = GridBagConstraints.REMAINDER; // c.gridy++; this.addView("ID_ADRESSE"); final DefaultElementSQLObject comp = (DefaultElementSQLObject) this.getView("ID_ADRESSE").getComp(); if (getTable().getFieldsName().contains("LIVRAISON_F")) { final JCheckBox boxLivr = new JCheckBox("Livr par le fournisseur"); this.add(boxLivr, c); this.addSQLObject(boxLivr, "LIVRAISON_F"); boxLivr.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { if (boxLivr.isSelected() && !comp.isCreated()) { comp.setCreated(true); if (CommandeSQLComponent.this.getTable().contains("ID_AFFAIRE")) { SQLRowValues rowVals = getLivraisonAdr( ((ElementComboBox) CommandeSQLComponent.this.getView("ID_AFFAIRE") .getComp()).getSelectedRow()); comp.setValue(rowVals); } } else { if (!boxLivr.isSelected()) { comp.setCreated(false); } } } }); } c.gridy++; this.add(comp, c); this.add(this.getView("ID_ADRESSE").getComp(), c); } else { c.gridy++; c.gridx = 0; this.add(new JLabel("Livraison"), c); c.gridx++; c.gridwidth = GridBagConstraints.REMAINDER; this.add(boxLivrClient, c); c.gridwidth = 1; final GridBagConstraints cAdr = new DefaultGridBagConstraints(); panelAdrSpec.add(new JLabel(getLabelFor("ID_CLIENT"), SwingConstants.RIGHT), cAdr); final ElementComboBox boxClient = new ElementComboBox(true); cAdr.weightx = 1; cAdr.gridx++; panelAdrSpec.add(boxClient, cAdr); this.addView(boxClient, "ID_CLIENT"); cAdr.gridy++; cAdr.weightx = 0; cAdr.gridx = 0; panelAdrSpec.add(new JLabel("Adresse", SwingConstants.RIGHT), cAdr); final SQLRequestComboBox boxAdr = new SQLRequestComboBox(true); boxAdr.uiInit(Configuration.getInstance().getDirectory().getElement(getTable().getTable("ADRESSE")) .getComboRequest(true)); boxClient.addModelListener("wantedID", new PropertyChangeListener() { @Override public void propertyChange(PropertyChangeEvent evt) { if (boxClient.getSelectedRow() != null && !boxClient.getSelectedRow().isUndefined()) { Where w = new Where(boxAdr.getRequest().getPrimaryTable().getField("ID_CLIENT"), "=", boxClient.getSelectedRow().getID()); w = w.or(new Where(boxAdr.getRequest().getPrimaryTable().getKey(), "=", boxClient.getSelectedRow().getInt("ID_ADRESSE"))); w = w.or(new Where(boxAdr.getRequest().getPrimaryTable().getKey(), "=", boxClient.getSelectedRow().getInt("ID_ADRESSE_F"))); w = w.or(new Where(boxAdr.getRequest().getPrimaryTable().getKey(), "=", boxClient.getSelectedRow().getInt("ID_ADRESSE_L"))); boxAdr.getRequest().setWhere(w); } else { boxAdr.getRequest().setWhere(null); } } }); cAdr.weightx = 1; cAdr.gridx++; panelAdrSpec.add(boxAdr, cAdr); cAdr.gridx = 0; cAdr.gridy++; cAdr.weightx = 0; if (getMode() == Mode.MODIFICATION) { panelAdrSpec.add(new JLabel(getLabelFor("ID_ADRESSE")), cAdr); } cAdr.gridx++; cAdr.gridwidth = GridBagConstraints.REMAINDER; this.addView("ID_ADRESSE"); compAdr = (DefaultElementSQLObject) this.getView("ID_ADRESSE").getComp(); cAdr.gridy++; if (getMode() == Mode.MODIFICATION) { panelAdrSpec.add(compAdr, cAdr); } boxAdr.addValueListener(new PropertyChangeListener() { @Override public void propertyChange(PropertyChangeEvent evt) { SQLRow row = boxAdr.getSelectedRow(); if (row != null && !row.isUndefined()) { compAdr.setCreated(true); SQLRowValues asRowValues = new SQLRowValues(row.asRowValues()); compAdr.setValue(asRowValues); } } }); c.gridy++; c.gridx = 0; c.gridwidth = GridBagConstraints.REMAINDER; c.weightx = 1; this.add(panelAdrSpec, c); c.gridwidth = 1; c.weightx = 0; boxLivrClient.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { panelAdrSpec.setVisible(boxLivrClient.isSelected()); if (!boxLivrClient.isSelected()) { boxClient.setValue((Integer) null); boxAdr.setValue((Integer) null); compAdr.setCreated(false); } } }); panelAdrSpec.setVisible(false); } } c.gridwidth = 1; // Champ Module c.gridx = 0; c.gridy++; c.gridwidth = GridBagConstraints.REMAINDER; final JPanel addP = ComptaSQLConfElement.createAdditionalPanel(); this.setAdditionalFieldsPanel(new FormLayouter(addP, 2)); this.add(addP, c); c.gridy++; c.gridwidth = 1; final ElementComboBox boxDevise = new ElementComboBox(); if (DefaultNXProps.getInstance().getBooleanValue(AbstractVenteArticleItemTable.ARTICLE_SHOW_DEVISE, false)) { // Devise c.gridx = 0; c.gridy++; c.weightx = 0; c.fill = GridBagConstraints.HORIZONTAL; this.add(new JLabel(getLabelFor("ID_DEVISE"), SwingConstants.RIGHT), c); c.gridx = GridBagConstraints.RELATIVE; c.gridwidth = 1; c.weightx = 1; c.weighty = 0; c.fill = GridBagConstraints.NONE; this.add(boxDevise, c); this.addView(boxDevise, "ID_DEVISE"); } // Reference c.gridx = 0; c.gridy++; c.gridwidth = 1; c.weightx = 0; c.fill = GridBagConstraints.HORIZONTAL; c.anchor = GridBagConstraints.EAST; this.add(new JLabel(getLabelFor("NOM"), SwingConstants.RIGHT), c); final JTextField textNom = new JTextField(); c.gridx++; c.weightx = 1; this.add(textNom, c); String field; field = "ID_COMMERCIAL"; // Commercial c.weightx = 0; c.gridx++; this.add(new JLabel(getLabelFor(field), SwingConstants.RIGHT), c); ElementComboBox commSel = new ElementComboBox(false, 25); c.gridx = GridBagConstraints.RELATIVE; c.gridwidth = 1; c.weightx = 1; c.weighty = 0; c.fill = GridBagConstraints.NONE; c.anchor = GridBagConstraints.WEST; this.add(commSel, c); addRequiredSQLObject(commSel, field); // Table d'lment c.fill = GridBagConstraints.BOTH; c.gridy++; c.gridx = 0; c.weightx = 0; c.weighty = 1; c.gridwidth = 4; this.add(this.table, c); if (DefaultNXProps.getInstance().getBooleanValue(AbstractVenteArticleItemTable.ARTICLE_SHOW_DEVISE, false)) { boxDevise.addValueListener(new PropertyChangeListener() { @Override public void propertyChange(PropertyChangeEvent evt) { table.setDevise(boxDevise.getSelectedRow()); } }); } this.fourn.addValueListener(new PropertyChangeListener() { @Override public void propertyChange(PropertyChangeEvent evt) { table.setFournisseur(fourn.getSelectedRow()); } }); // Bottom c.gridy++; c.weighty = 0; this.add(getBottomPanel(), c); c.gridx = 0; c.gridy++; c.fill = GridBagConstraints.HORIZONTAL; c.anchor = GridBagConstraints.WEST; JPanel panelOO = new JPanel(new FlowLayout(FlowLayout.RIGHT)); panelOO.add(this.checkImpression, c); panelOO.add(this.checkVisu, c); c.gridwidth = GridBagConstraints.REMAINDER; this.add(panelOO, c); addRequiredSQLObject(this.fourn, "ID_FOURNISSEUR"); addSQLObject(textNom, "NOM"); addRequiredSQLObject(dateCommande, "DATE"); // addRequiredSQLObject(radioEtat, "ID_ETAT_DEVIS"); addRequiredSQLObject(this.numeroUniqueCommande, "NUMERO"); addSQLObject(this.infos, "INFOS"); this.numeroUniqueCommande.setText(NumerotationAutoSQLElement.getNextNumero(CommandeSQLElement.class)); // radioEtat.setValue(EtatDevisSQLElement.EN_ATTENTE); // this.numeroUniqueDevis.addLabelWarningMouseListener(new MouseAdapter() { // public void mousePressed(MouseEvent e) { // // if (e.getClickCount() == 2 && e.getButton() == MouseEvent.BUTTON1) { // numeroUniqueDevis.setText(NumerotationAutoSQLElement.getNextNumeroDevis()); // } // } // }); DefaultGridBagConstraints.lockMinimumSize(this.fourn); DefaultGridBagConstraints.lockMinimumSize(commSel); }
From source file:eu.ggnet.dwoss.receipt.unit.UnitView.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/*from w ww . j ava 2s .c o m*/ * Editor. */ @SuppressWarnings("unchecked") // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents private void initComponents() { java.awt.GridBagConstraints gridBagConstraints; manufacturerButtonGroup = new javax.swing.ButtonGroup(); jPanel1 = new javax.swing.JPanel(); unitSplitPane = new javax.swing.JSplitPane(); unitWritePanel = new javax.swing.JPanel(); internalCommentAreaScrollPane = new javax.swing.JScrollPane(); internalCommentArea = new javax.swing.JTextArea(); commentAreaScrollPane = new javax.swing.JScrollPane(); commentArea = new javax.swing.JTextArea(); unitItemLabel = new javax.swing.JLabel(); unitStatusLabel = new javax.swing.JLabel(); unitStateBox = new javax.swing.JComboBox(); editProductButton = new javax.swing.JButton(); partNoField = new javax.swing.JTextField(); refurbishedIdField = new javax.swing.JTextField(); unitSnLabel = new javax.swing.JLabel(); unitNumberLabel = new javax.swing.JLabel(); serialField = new javax.swing.JTextField(); editRefurbishedIdButton = new javax.swing.JButton(); mfgLabel = new javax.swing.JLabel(); mfgDateChooser = new com.toedter.calendar.JDateChooser(); jLabel3 = new javax.swing.JLabel(); warrantyTillChooser = new com.toedter.calendar.JDateChooser(); jLabel4 = new javax.swing.JLabel(); warrantyTypeChooser = new javax.swing.JComboBox(); manufacturerPanel = new javax.swing.JPanel(); contractorBox = new javax.swing.JComboBox(); jScrollPane3 = new javax.swing.JScrollPane(); equipmentTable = new javax.swing.JTable(); jScrollPane4 = new javax.swing.JScrollPane(); commentTable = new javax.swing.JTable(); jScrollPane5 = new javax.swing.JScrollPane(); internalCommentTable = new javax.swing.JTable(); unitReadPanel = new javax.swing.JPanel(); unitShipLabel = new javax.swing.JLabel(); unitShipField = new javax.swing.JTextField(); unitOwnerLabel = new javax.swing.JLabel(); unitOwnerField = new javax.swing.JTextField(); jLabel1 = new javax.swing.JLabel(); jScrollPane2 = new javax.swing.JScrollPane(); detailArea = new javax.swing.JEditorPane(); messagesButton = new javax.swing.JButton(); operationButtonPanel = new javax.swing.JPanel(); cancelButton = new javax.swing.JButton(); setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE); setTitle("Gert bearbeiten/aufnehmen"); setMinimumSize(new java.awt.Dimension(1080, 700)); addWindowListener(new java.awt.event.WindowAdapter() { public void windowClosing(java.awt.event.WindowEvent evt) { formWindowClosing(evt); } }); unitSplitPane.setDividerLocation(600); unitSplitPane.setResizeWeight(1.0); unitSplitPane.setCursor(new java.awt.Cursor(java.awt.Cursor.DEFAULT_CURSOR)); unitSplitPane.setDoubleBuffered(true); unitWritePanel.setBorder(javax.swing.BorderFactory.createTitledBorder( javax.swing.BorderFactory.createEtchedBorder(javax.swing.border.EtchedBorder.RAISED, new java.awt.Color(204, 204, 255), new java.awt.Color(51, 51, 51)))); unitWritePanel.setMinimumSize(new java.awt.Dimension(500, 400)); unitWritePanel.setPreferredSize(new java.awt.Dimension(500, 400)); unitWritePanel.setLayout(new java.awt.GridBagLayout()); internalCommentArea.setColumns(20); internalCommentArea.setLineWrap(true); internalCommentArea.setRows(5); internalCommentArea.setWrapStyleWord(true); internalCommentAreaScrollPane.setViewportView(internalCommentArea); gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.gridx = 3; gridBagConstraints.gridy = 10; gridBagConstraints.fill = java.awt.GridBagConstraints.BOTH; gridBagConstraints.anchor = java.awt.GridBagConstraints.FIRST_LINE_START; gridBagConstraints.weighty = 0.1; gridBagConstraints.insets = new java.awt.Insets(2, 2, 2, 2); unitWritePanel.add(internalCommentAreaScrollPane, gridBagConstraints); commentArea.setColumns(20); commentArea.setLineWrap(true); commentArea.setRows(5); commentArea.setWrapStyleWord(true); commentAreaScrollPane.setViewportView(commentArea); gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.gridx = 0; gridBagConstraints.gridy = 10; gridBagConstraints.gridwidth = 3; gridBagConstraints.fill = java.awt.GridBagConstraints.BOTH; gridBagConstraints.anchor = java.awt.GridBagConstraints.FIRST_LINE_START; gridBagConstraints.weighty = 0.1; gridBagConstraints.insets = new java.awt.Insets(2, 2, 2, 2); unitWritePanel.add(commentAreaScrollPane, gridBagConstraints); unitItemLabel.setText("ArtikelNr:"); gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.gridx = 0; gridBagConstraints.gridy = 3; gridBagConstraints.anchor = java.awt.GridBagConstraints.LINE_END; gridBagConstraints.insets = new java.awt.Insets(2, 2, 2, 2); unitWritePanel.add(unitItemLabel, gridBagConstraints); unitStatusLabel.setText("Zustand:"); gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.gridx = 0; gridBagConstraints.gridy = 5; gridBagConstraints.anchor = java.awt.GridBagConstraints.LINE_END; gridBagConstraints.insets = new java.awt.Insets(2, 2, 2, 2); unitWritePanel.add(unitStatusLabel, gridBagConstraints); unitStateBox.setNextFocusableComponent(warrantyTillChooser); gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.gridx = 1; gridBagConstraints.gridy = 5; gridBagConstraints.gridwidth = 2; gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL; gridBagConstraints.insets = new java.awt.Insets(2, 2, 2, 2); unitWritePanel.add(unitStateBox, gridBagConstraints); editProductButton.setText("Edit"); editProductButton.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { editProductButtonActionPerformed(evt); } }); gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.gridx = 2; gridBagConstraints.gridy = 3; gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL; unitWritePanel.add(editProductButton, gridBagConstraints); partNoField.setName("partNo"); // NOI18N partNoField.setNextFocusableComponent(unitStateBox); partNoField.addFocusListener(new java.awt.event.FocusAdapter() { public void focusLost(java.awt.event.FocusEvent evt) { partNoFieldFocusLost(evt); } }); gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.gridx = 1; gridBagConstraints.gridy = 3; gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL; gridBagConstraints.insets = new java.awt.Insets(2, 2, 2, 2); unitWritePanel.add(partNoField, gridBagConstraints); refurbishedIdField.setName("refurbishId"); // NOI18N refurbishedIdField.setNextFocusableComponent(serialField); refurbishedIdField.addFocusListener(new java.awt.event.FocusAdapter() { public void focusLost(java.awt.event.FocusEvent evt) { refurbishedIdFieldFocusLost(evt); } }); gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.gridx = 1; gridBagConstraints.gridy = 1; gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL; gridBagConstraints.weightx = 0.1; gridBagConstraints.insets = new java.awt.Insets(2, 2, 2, 2); unitWritePanel.add(refurbishedIdField, gridBagConstraints); unitSnLabel.setText("SerienNr:"); gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.gridx = 0; gridBagConstraints.gridy = 2; gridBagConstraints.anchor = java.awt.GridBagConstraints.LINE_END; gridBagConstraints.insets = new java.awt.Insets(5, 2, 2, 2); unitWritePanel.add(unitSnLabel, gridBagConstraints); unitNumberLabel.setText("SopoNr:"); gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.gridx = 0; gridBagConstraints.gridy = 1; gridBagConstraints.anchor = java.awt.GridBagConstraints.LINE_END; gridBagConstraints.insets = new java.awt.Insets(2, 2, 2, 2); unitWritePanel.add(unitNumberLabel, gridBagConstraints); serialField.setName("serial"); // NOI18N serialField.setNextFocusableComponent(partNoField); serialField.addFocusListener(new java.awt.event.FocusAdapter() { public void focusLost(java.awt.event.FocusEvent evt) { serialFieldFocusLost(evt); } }); gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.gridx = 1; gridBagConstraints.gridy = 2; gridBagConstraints.gridwidth = 2; gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL; gridBagConstraints.insets = new java.awt.Insets(2, 2, 2, 2); unitWritePanel.add(serialField, gridBagConstraints); editRefurbishedIdButton.setText("Edit"); editRefurbishedIdButton.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { editRefurbishedIdButtonActionPerformed(evt); } }); gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.gridx = 2; gridBagConstraints.gridy = 1; gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL; unitWritePanel.add(editRefurbishedIdButton, gridBagConstraints); mfgLabel.setText("MFG Date:"); gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.gridx = 0; gridBagConstraints.gridy = 4; gridBagConstraints.anchor = java.awt.GridBagConstraints.LINE_END; unitWritePanel.add(mfgLabel, gridBagConstraints); gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.gridx = 1; gridBagConstraints.gridy = 4; gridBagConstraints.gridwidth = 2; gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL; gridBagConstraints.insets = new java.awt.Insets(2, 2, 2, 2); unitWritePanel.add(mfgDateChooser, gridBagConstraints); jLabel3.setText("Garantie bis:"); gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.gridx = 0; gridBagConstraints.gridy = 7; gridBagConstraints.anchor = java.awt.GridBagConstraints.FIRST_LINE_END; gridBagConstraints.insets = new java.awt.Insets(8, 0, 0, 0); unitWritePanel.add(jLabel3, gridBagConstraints); warrantyTillChooser.setEnabled(false); gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.gridx = 1; gridBagConstraints.gridy = 7; gridBagConstraints.gridwidth = 2; gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL; gridBagConstraints.anchor = java.awt.GridBagConstraints.PAGE_START; gridBagConstraints.insets = new java.awt.Insets(2, 2, 2, 2); unitWritePanel.add(warrantyTillChooser, gridBagConstraints); jLabel4.setText("Garantietyp:"); gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.gridx = 0; gridBagConstraints.gridy = 6; gridBagConstraints.anchor = java.awt.GridBagConstraints.LINE_END; unitWritePanel.add(jLabel4, gridBagConstraints); warrantyTypeChooser.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { warrantyTypeChooserActionPerformed(evt); } }); gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.gridx = 1; gridBagConstraints.gridy = 6; gridBagConstraints.gridwidth = 2; gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL; gridBagConstraints.anchor = java.awt.GridBagConstraints.FIRST_LINE_START; gridBagConstraints.insets = new java.awt.Insets(2, 2, 2, 2); unitWritePanel.add(warrantyTypeChooser, gridBagConstraints); manufacturerPanel.setBorder(javax.swing.BorderFactory.createTitledBorder("Hersteller Support")); contractorBox.setModel( new javax.swing.DefaultComboBoxModel(new String[] { "Item 1", "Item 2", "Item 3", "Item 4" })); contractorBox.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { contractorBoxActionPerformed(evt); } }); javax.swing.GroupLayout manufacturerPanelLayout = new javax.swing.GroupLayout(manufacturerPanel); manufacturerPanel.setLayout(manufacturerPanelLayout); manufacturerPanelLayout.setHorizontalGroup( manufacturerPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING).addComponent( contractorBox, javax.swing.GroupLayout.Alignment.TRAILING, 0, 333, Short.MAX_VALUE)); manufacturerPanelLayout.setVerticalGroup( manufacturerPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addComponent(contractorBox, javax.swing.GroupLayout.Alignment.TRAILING)); gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.gridx = 0; gridBagConstraints.gridy = 0; gridBagConstraints.gridwidth = 3; gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL; unitWritePanel.add(manufacturerPanel, gridBagConstraints); equipmentTable .setModel(new javax.swing.table.DefaultTableModel( new Object[][] { { null, null, null, null }, { null, null, null, null }, { null, null, null, null }, { null, null, null, null } }, new String[] { "Title 1", "Title 2", "Title 3", "Title 4" })); jScrollPane3.setViewportView(equipmentTable); gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.gridx = 3; gridBagConstraints.gridy = 0; gridBagConstraints.gridheight = 9; gridBagConstraints.fill = java.awt.GridBagConstraints.BOTH; gridBagConstraints.weightx = 0.1; gridBagConstraints.weighty = 0.2; gridBagConstraints.insets = new java.awt.Insets(2, 2, 2, 2); unitWritePanel.add(jScrollPane3, gridBagConstraints); commentTable .setModel(new javax.swing.table.DefaultTableModel( new Object[][] { { null, null, null, null }, { null, null, null, null }, { null, null, null, null }, { null, null, null, null } }, new String[] { "Title 1", "Title 2", "Title 3", "Title 4" })); jScrollPane4.setViewportView(commentTable); gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.gridx = 0; gridBagConstraints.gridy = 8; gridBagConstraints.gridwidth = 3; gridBagConstraints.gridheight = 2; gridBagConstraints.fill = java.awt.GridBagConstraints.BOTH; gridBagConstraints.weighty = 0.2; gridBagConstraints.insets = new java.awt.Insets(2, 2, 2, 2); unitWritePanel.add(jScrollPane4, gridBagConstraints); internalCommentTable .setModel(new javax.swing.table.DefaultTableModel( new Object[][] { { null, null, null, null }, { null, null, null, null }, { null, null, null, null }, { null, null, null, null } }, new String[] { "Title 1", "Title 2", "Title 3", "Title 4" })); jScrollPane5.setViewportView(internalCommentTable); gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.gridx = 3; gridBagConstraints.gridy = 9; gridBagConstraints.fill = java.awt.GridBagConstraints.BOTH; gridBagConstraints.weightx = 0.1; gridBagConstraints.weighty = 0.2; gridBagConstraints.insets = new java.awt.Insets(2, 2, 2, 2); unitWritePanel.add(jScrollPane5, gridBagConstraints); unitSplitPane.setLeftComponent(unitWritePanel); unitReadPanel.setBorder(javax.swing.BorderFactory.createTitledBorder( javax.swing.BorderFactory.createEtchedBorder(javax.swing.border.EtchedBorder.RAISED, new java.awt.Color(204, 204, 255), java.awt.Color.black))); unitShipLabel.setText("Shipment ID:"); unitShipField.setEditable(false); unitShipField.setFocusable(false); unitOwnerLabel.setText("Besitzer:"); unitOwnerField.setEditable(false); unitOwnerField.setFocusable(false); jLabel1.setText("Details:"); jScrollPane2.setFocusable(false); detailArea.setContentType("text/html"); // NOI18N detailArea.setFocusable(false); jScrollPane2.setViewportView(detailArea); messagesButton.setText("Meldungen"); messagesButton.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { messagesButtonActionPerformed(evt); } }); javax.swing.GroupLayout unitReadPanelLayout = new javax.swing.GroupLayout(unitReadPanel); unitReadPanel.setLayout(unitReadPanelLayout); unitReadPanelLayout.setHorizontalGroup(unitReadPanelLayout .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addComponent(jScrollPane2, javax.swing.GroupLayout.DEFAULT_SIZE, 393, Short.MAX_VALUE) .addGroup(unitReadPanelLayout.createSequentialGroup() .addGroup(unitReadPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addComponent(unitShipLabel).addComponent(unitOwnerLabel)) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addGroup(unitReadPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addComponent(unitShipField, javax.swing.GroupLayout.DEFAULT_SIZE, 308, Short.MAX_VALUE) .addComponent(unitOwnerField, javax.swing.GroupLayout.DEFAULT_SIZE, 308, Short.MAX_VALUE))) .addGroup(unitReadPanelLayout.createSequentialGroup().addComponent(jLabel1).addGap(0, 346, Short.MAX_VALUE)) .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, unitReadPanelLayout.createSequentialGroup() .addGap(0, 0, Short.MAX_VALUE).addComponent(messagesButton))); unitReadPanelLayout.setVerticalGroup(unitReadPanelLayout .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(unitReadPanelLayout.createSequentialGroup().addGroup(unitReadPanelLayout .createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE).addComponent(unitShipLabel) .addComponent(unitShipField, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addGroup( unitReadPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(unitOwnerLabel).addComponent(unitOwnerField, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED).addComponent(jLabel1) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addComponent(jScrollPane2, javax.swing.GroupLayout.DEFAULT_SIZE, 414, Short.MAX_VALUE) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addComponent(messagesButton))); unitSplitPane.setRightComponent(unitReadPanel); javax.swing.GroupLayout jPanel1Layout = new javax.swing.GroupLayout(jPanel1); jPanel1.setLayout(jPanel1Layout); jPanel1Layout.setHorizontalGroup(jPanel1Layout .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(jPanel1Layout.createSequentialGroup().addContainerGap() .addComponent(unitSplitPane, javax.swing.GroupLayout.DEFAULT_SIZE, 1008, Short.MAX_VALUE) .addContainerGap())); jPanel1Layout.setVerticalGroup( jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING).addGroup(jPanel1Layout .createSequentialGroup().addContainerGap().addComponent(unitSplitPane).addContainerGap())); operationButtonPanel.setBorder(javax.swing.BorderFactory.createEtchedBorder()); operationButtonPanel.setLayout(new java.awt.FlowLayout(java.awt.FlowLayout.RIGHT)); cancelButton.setText("Abbrechen"); cancelButton.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { cancelButtonActionPerformed(evt); } }); javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane()); getContentPane().setLayout(layout); layout.setHorizontalGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addComponent(jPanel1, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup().addContainerGap().addComponent(cancelButton) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addComponent(operationButtonPanel, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))); layout.setVerticalGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup() .addComponent(jPanel1, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addComponent(operationButtonPanel, javax.swing.GroupLayout.PREFERRED_SIZE, 45, javax.swing.GroupLayout.PREFERRED_SIZE) .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup() .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addComponent(cancelButton).addContainerGap())))); pack(); }
From source file:edu.harvard.mcz.imagecapture.LoginDialog.java
/** * This method initializes jPanelAdvanced * //w ww. ja v a 2 s.c om * @return javax.swing.JPanel */ private JPanel getJPanelAdvanced() { if (jPanelAdvanced == null) { GridBagConstraints gridBagConstraints3 = new GridBagConstraints(); gridBagConstraints3.anchor = GridBagConstraints.WEST; gridBagConstraints3.gridx = 1; gridBagConstraints3.gridy = 1; gridBagConstraints3.weightx = 1.0; gridBagConstraints3.fill = GridBagConstraints.BOTH; GridBagConstraints gridBagConstraints4 = new GridBagConstraints(); gridBagConstraints4.anchor = GridBagConstraints.EAST; gridBagConstraints4.gridy = 1; gridBagConstraints4.insets = new Insets(0, 15, 0, 0); gridBagConstraints4.gridx = 0; GridBagConstraints gridBagConstraints1 = new GridBagConstraints(); gridBagConstraints1.anchor = GridBagConstraints.WEST; gridBagConstraints1.gridx = 1; gridBagConstraints1.gridy = 0; gridBagConstraints1.weightx = 1.0; gridBagConstraints1.fill = GridBagConstraints.BOTH; GridBagConstraints gridBagConstraints = new GridBagConstraints(); gridBagConstraints.anchor = GridBagConstraints.EAST; gridBagConstraints.gridy = 0; gridBagConstraints.gridx = 0; GridBagConstraints gridBagConstraints10 = new GridBagConstraints(); gridBagConstraints10.anchor = GridBagConstraints.WEST; gridBagConstraints10.gridx = 1; gridBagConstraints10.gridy = 3; gridBagConstraints10.weightx = 1.0; gridBagConstraints10.fill = GridBagConstraints.BOTH; GridBagConstraints gridBagConstraints14 = new GridBagConstraints(); gridBagConstraints14.anchor = GridBagConstraints.WEST; gridBagConstraints14.gridx = 1; gridBagConstraints14.gridy = 2; gridBagConstraints14.fill = GridBagConstraints.BOTH; GridBagConstraints gridBagConstraints9 = new GridBagConstraints(); gridBagConstraints9.anchor = GridBagConstraints.EAST; gridBagConstraints9.gridy = 3; gridBagConstraints9.gridx = 0; GridBagConstraints gridBagConstraints6 = new GridBagConstraints(); gridBagConstraints6.anchor = GridBagConstraints.WEST; gridBagConstraints6.gridx = 1; gridBagConstraints6.gridy = 2; gridBagConstraints6.weightx = 1.0; gridBagConstraints6.fill = GridBagConstraints.BOTH; GridBagConstraints gridBagConstraints5 = new GridBagConstraints(); gridBagConstraints5.anchor = GridBagConstraints.EAST; gridBagConstraints5.gridy = 2; gridBagConstraints5.gridx = 0; GridBagConstraints gridBagConstraints8 = new GridBagConstraints(); gridBagConstraints8.anchor = GridBagConstraints.WEST; gridBagConstraints8.gridx = 1; gridBagConstraints8.gridy = 5; gridBagConstraints8.weightx = 1.0; gridBagConstraints8.fill = GridBagConstraints.BOTH; GridBagConstraints gridBagConstraints7 = new GridBagConstraints(); gridBagConstraints7.anchor = GridBagConstraints.EAST; gridBagConstraints7.gridx = 0; gridBagConstraints7.gridy = 5; gridBagConstraints7.insets = new Insets(0, 5, 0, 0); jPanelAdvanced = new JPanel(); jPanelAdvanced.setLayout(new GridBagLayout()); jPanelAdvanced.add(jLabel3, gridBagConstraints7); jPanelAdvanced.add(getJTextFieldConnection(), gridBagConstraints8); jPanelAdvanced.add(jLabel2, gridBagConstraints5); jPanelAdvanced.add(getJTextFieldDriver(), gridBagConstraints6); jPanelAdvanced.add(jLabel4, gridBagConstraints9); jPanelAdvanced.add(getJTextFieldDialect(), gridBagConstraints10); jPanelAdvanced.add(jLabel, gridBagConstraints); jPanelAdvanced.add(getJTextFieldUsername(), gridBagConstraints1); jPanelAdvanced.add(jLabel1, gridBagConstraints4); jPanelAdvanced.add(getJPasswordFieldDB(), gridBagConstraints3); } return jPanelAdvanced; }