private void setupLayout() { mainLayout.putConstraint(SpringLayout.SOUTH, chatterButton, -10, SpringLayout.SOUTH, this); mainLayout.putConstraint(SpringLayout.EAST, chatterButton, -10, SpringLayout.EAST, this); mainLayout.putConstraint(SpringLayout.NORTH, chatterText, 33, SpringLayout.NORTH, this); mainLayout.putConstraint(SpringLayout.WEST, chatterText, -406, SpringLayout.EAST, this); mainLayout.putConstraint(SpringLayout.SOUTH, chatterText, 229, SpringLayout.NORTH, this); mainLayout.putConstraint(SpringLayout.EAST, chatterText, -39, SpringLayout.EAST, this); }
private JPanel createContentPanel() { // compute content and other buttons SpringLayout springLayout = new SpringLayout(); JPanel panel = new JPanel(springLayout); int panelHeight = 0; JTable propertiesPanel = createPropertiesPanel(); panelHeight += propertiesPanel.getPreferredSize().getHeight(); panel.add(propertiesPanel); panelHeight += 10; panel.add(Box.createVerticalStrut(10)); JScrollPane scrollPane = new JScrollPane(createAdaptersPanel()); panelHeight += scrollPane.getPreferredSize().getHeight(); panel.add(scrollPane); panelHeight += 10; panel.add(Box.createVerticalStrut(10)); JPanel buttonsPanel = createButtonsPanel(); panelHeight += buttonsPanel.getPreferredSize().getHeight(); panel.add(buttonsPanel); springLayout.putConstraint( SpringLayout.NORTH, panel, DEFAULT_PADDING, SpringLayout.NORTH, propertiesPanel); springLayout.putConstraint( SpringLayout.WEST, panel, DEFAULT_PADDING, SpringLayout.WEST, propertiesPanel); springLayout.putConstraint( SpringLayout.EAST, panel, DEFAULT_PADDING, SpringLayout.EAST, propertiesPanel); springLayout.putConstraint( SpringLayout.NORTH, scrollPane, DEFAULT_PADDING, SpringLayout.SOUTH, propertiesPanel); springLayout.putConstraint( SpringLayout.WEST, panel, DEFAULT_PADDING, SpringLayout.WEST, scrollPane); springLayout.putConstraint( SpringLayout.EAST, panel, DEFAULT_PADDING, SpringLayout.EAST, scrollPane); springLayout.putConstraint( SpringLayout.NORTH, scrollPane, DEFAULT_PADDING, SpringLayout.SOUTH, buttonsPanel); springLayout.putConstraint( SpringLayout.WEST, panel, DEFAULT_PADDING, SpringLayout.WEST, buttonsPanel); springLayout.putConstraint( SpringLayout.EAST, panel, DEFAULT_PADDING, SpringLayout.EAST, buttonsPanel); panel.setPreferredSize( new Dimension( CHECK_COLUMN_WIDTH + LABEL_COLUMN_WIDTH + COLUMN_WIDTH - 32, panelHeight + DEFAULT_PADDING)); makeCompactGrid(panel, 5, 1, 0, 0, 0, 0); return panel; }
// --------------------------------initGUI------------------------------------ public void initGUI() { bDeployed = bOpponentDeployed = false; listAT = new LinkedList(); frame.setJMenuBar(new GameMenuBar(this)); panParty = new PartyPanel(200, 480); panStatus = new JPanel(null); oMap = new Map(600, 350); panChat = new ChatPanel(600, 200); Container contentPane = frame.getContentPane(); panParty.setOpaque(true); panStatus.setOpaque(true); panChat.setOpaque(true); panStatus.setPreferredSize(new Dimension(200, 70)); contentPane.add(panStatus); contentPane.add(panParty); contentPane.add(oMap); contentPane.add(panChat); SpringLayout oLayout = new SpringLayout(); contentPane.setLayout(oLayout); oLayout.putConstraint(SpringLayout.WEST, panParty, 0, SpringLayout.WEST, contentPane); oLayout.putConstraint(SpringLayout.NORTH, panParty, 0, SpringLayout.NORTH, contentPane); oLayout.putConstraint(SpringLayout.WEST, panStatus, 0, SpringLayout.WEST, contentPane); oLayout.putConstraint(SpringLayout.SOUTH, panStatus, 0, SpringLayout.SOUTH, contentPane); oLayout.putConstraint(SpringLayout.EAST, oMap, 0, SpringLayout.EAST, contentPane); oLayout.putConstraint(SpringLayout.NORTH, oMap, 0, SpringLayout.NORTH, contentPane); oLayout.putConstraint(SpringLayout.WEST, panChat, 0, SpringLayout.EAST, panStatus); oLayout.putConstraint(SpringLayout.NORTH, panChat, 0, SpringLayout.SOUTH, oMap); oLayout.putConstraint(SpringLayout.EAST, contentPane, 0, SpringLayout.EAST, panChat); oLayout.putConstraint(SpringLayout.SOUTH, contentPane, 0, SpringLayout.SOUTH, panChat); panChat.validate(); panChat.setVisible(true); Insets oInsets = panStatus.getInsets(); int nX = oInsets.left + 5; int nY = oInsets.top + 5; lblStatus1 = new JLabel("Not Connected..."); lblStatus2 = new JLabel("No Party Formed..."); lblStatus3 = new JLabel(); Dimension oSize = lblStatus1.getPreferredSize(); lblStatus1.setBounds(nX, nY, 180, oSize.height); nY += oSize.height + 7; lblStatus2.setBounds(nX, nY, 180, oSize.height); nY += oSize.height + 7; lblStatus3.setBounds(nX, nY, 180, oSize.height); panStatus.add(lblStatus1); panStatus.add(lblStatus2); panStatus.add(lblStatus3); frame.pack(); frame.setResizable(false); frame.setLocation( ((scrBounds.x + scrBounds.width - frame.getWidth()) / 2), ((scrBounds.y + scrBounds.height - frame.getHeight()) / 2)); oMap.addKeyListener(oMap); oMap.setButtonEvents(this); }
public MasterConfigPanel() { this.setLayout(layout); Border blackline = BorderFactory.createLineBorder(Color.BLACK); for (int i = 0; i < textfield.length; i++) { label[i] = new JLabel(labels[i]); textfield[i] = new JTextField(20); this.add(label[i]); this.add(textfield[i]); textfield[i].addFocusListener(this); } label[5] = new JLabel(labels[5]); this.add(label[5]); combo = new JComboBox(trust); combo.setSelectedIndex(0); combo.addActionListener(this); this.add(combo); textfield[0].setText("<For Example: 10>"); textfield[1].setText("<For Example: AM10>"); textfield[2].setText("<For Example: modelbase.PurchaseLogicCollusion>"); textfield[3].setText("<For Example: modelbase.RatingLogicCollusion>"); textfield[4].setText("<For Example: 0,4,5,7,9>"); next_config = new JButton("Config"); this.add(next_config); brsConfig = new BRSConfigPanel(); TitledBorder brsTitle = BorderFactory.createTitledBorder(blackline, "BRS Trust Model Configuration"); brsConfig.setBorder(brsTitle); travosConfig = new TRAVOSConfigPanel(); TitledBorder travosTitle = BorderFactory.createTitledBorder(blackline, "TRAVOS Trust Model Configuration"); travosConfig.setBorder(travosTitle); personalizedConfig = new PersonalizedConfigPanel(); TitledBorder personalizedTitle = BorderFactory.createTitledBorder(blackline, "Personalized Trust Model Configuration"); personalizedConfig.setBorder(personalizedTitle); othersConfig = new OthersConfigPanel(); TitledBorder othersTitle = BorderFactory.createTitledBorder(blackline, "Others Trust Model Configuration"); othersConfig.setBorder(othersTitle); this.add(brsConfig); this.add(travosConfig); this.add(personalizedConfig); this.add(othersConfig); layout.putConstraint(SpringLayout.WEST, label[0], 5, SpringLayout.WEST, this); layout.putConstraint(SpringLayout.NORTH, label[0], 5, SpringLayout.NORTH, this); layout.putConstraint(SpringLayout.WEST, textfield[0], 95, SpringLayout.EAST, label[0]); layout.putConstraint(SpringLayout.NORTH, textfield[0], 5, SpringLayout.NORTH, this); for (int i = 1; i < textfield.length; i++) { layout.putConstraint(SpringLayout.WEST, label[i], 5, SpringLayout.WEST, this); layout.putConstraint(SpringLayout.NORTH, label[i], 5, SpringLayout.SOUTH, textfield[i - 1]); layout.putConstraint(SpringLayout.WEST, textfield[i], 0, SpringLayout.WEST, textfield[i - 1]); layout.putConstraint( SpringLayout.NORTH, textfield[i], 5, SpringLayout.SOUTH, textfield[i - 1]); layout.putConstraint(SpringLayout.EAST, textfield[i], 0, SpringLayout.EAST, textfield[0]); } layout.putConstraint(SpringLayout.WEST, label[5], 5, SpringLayout.WEST, this); layout.putConstraint(SpringLayout.NORTH, label[5], 5, SpringLayout.SOUTH, textfield[4]); layout.putConstraint(SpringLayout.WEST, combo, 0, SpringLayout.WEST, textfield[4]); layout.putConstraint(SpringLayout.NORTH, combo, 5, SpringLayout.SOUTH, textfield[4]); layout.putConstraint(SpringLayout.EAST, combo, 0, SpringLayout.EAST, textfield[0]); layout.putConstraint(SpringLayout.WEST, brsConfig, 5, SpringLayout.WEST, this); layout.putConstraint(SpringLayout.NORTH, brsConfig, 5, SpringLayout.SOUTH, combo); layout.putConstraint(SpringLayout.EAST, brsConfig, 5, SpringLayout.EAST, combo); layout.putConstraint(SpringLayout.WEST, travosConfig, 5, SpringLayout.WEST, this); layout.putConstraint(SpringLayout.NORTH, travosConfig, 5, SpringLayout.SOUTH, combo); layout.putConstraint(SpringLayout.EAST, travosConfig, 5, SpringLayout.EAST, combo); layout.putConstraint(SpringLayout.WEST, personalizedConfig, 5, SpringLayout.WEST, this); layout.putConstraint(SpringLayout.NORTH, personalizedConfig, 5, SpringLayout.SOUTH, combo); layout.putConstraint(SpringLayout.EAST, personalizedConfig, 5, SpringLayout.EAST, combo); layout.putConstraint(SpringLayout.WEST, othersConfig, 5, SpringLayout.WEST, this); layout.putConstraint(SpringLayout.NORTH, othersConfig, 5, SpringLayout.SOUTH, combo); layout.putConstraint(SpringLayout.EAST, othersConfig, 5, SpringLayout.EAST, combo); layout.putConstraint(SpringLayout.WEST, next_config, 0, SpringLayout.WEST, textfield[0]); layout.putConstraint( SpringLayout.NORTH, next_config, 5, SpringLayout.SOUTH, personalizedConfig); layout.putConstraint(SpringLayout.SOUTH, this, 5, SpringLayout.SOUTH, next_config); this.setVisible(false); }
private void initComponents() { setPreferredSize(new java.awt.Dimension(420, 65)); this.setLayout(new BoxLayout(this, BoxLayout.Y_AXIS)); JPanel buttonPanel = new JPanel(); buttonPanel.setLayout(new FlowLayout(FlowLayout.LEFT)); JPanel textPanel = new JPanel(); SpringLayout textLayout = new SpringLayout(); textPanel.setLayout(textLayout); this.add(buttonPanel); this.add(textPanel); // button area abortButton_ = new JButton(); abortButton_.setBackground(new java.awt.Color(255, 255, 255)); abortButton_.setIcon( new javax.swing.ImageIcon( getClass().getResource("/org/micromanager/icons/cancel.png"))); // NOI18N abortButton_.setToolTipText("Abort acquisition"); abortButton_.setFocusable(false); abortButton_.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER); abortButton_.setMaximumSize(new java.awt.Dimension(30, 28)); abortButton_.setMinimumSize(new java.awt.Dimension(30, 28)); abortButton_.setPreferredSize(new java.awt.Dimension(30, 28)); abortButton_.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM); abortButton_.addActionListener( new ActionListener() { public void actionPerformed(ActionEvent e) { try { JavaUtils.invokeRestrictedMethod(vad_, VirtualAcquisitionDisplay.class, "abort"); } catch (Exception ex) { ReportingUtils.showError( "Couldn't abort. Try pressing stop on Multi-Dimensional acquisition Window"); } } }); buttonPanel.add(abortButton_); pauseButton_ = new JButton(); pauseButton_.setIcon( new javax.swing.ImageIcon( getClass().getResource("/org/micromanager/icons/control_pause.png"))); // NOI18N pauseButton_.setToolTipText("Pause acquisition"); pauseButton_.setFocusable(false); pauseButton_.setMargin(new java.awt.Insets(0, 0, 0, 0)); pauseButton_.setMaximumSize(new java.awt.Dimension(30, 28)); pauseButton_.setMinimumSize(new java.awt.Dimension(30, 28)); pauseButton_.setPreferredSize(new java.awt.Dimension(30, 28)); pauseButton_.addActionListener( new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { try { JavaUtils.invokeRestrictedMethod(vad_, VirtualAcquisitionDisplay.class, "pause"); } catch (Exception ex) { ReportingUtils.showError("Couldn't pause"); } if (eng_.isPaused()) { pauseButton_.setIcon( new javax.swing.ImageIcon( getClass() .getResource("/org/micromanager/icons/resultset_next.png"))); // NOI18N } else { pauseButton_.setIcon( new javax.swing.ImageIcon( getClass() .getResource("/org/micromanager/icons/control_pause.png"))); // NOI18N } } }); buttonPanel.add(pauseButton_); gridXSpinner_ = new JSpinner(); gridXSpinner_.setModel(new SpinnerNumberModel(2, 1, 1000, 1)); gridXSpinner_.setPreferredSize(new Dimension(35, 24)); gridYSpinner_ = new JSpinner(); gridYSpinner_.setModel(new SpinnerNumberModel(2, 1, 1000, 1)); gridYSpinner_.setPreferredSize(new Dimension(35, 24)); gridXSpinner_.addChangeListener( new ChangeListener() { @Override public void stateChanged(ChangeEvent e) { gridSizeChanged(); } }); gridYSpinner_.addChangeListener( new ChangeListener() { @Override public void stateChanged(ChangeEvent e) { gridSizeChanged(); } }); final JLabel gridLabel = new JLabel(" grid"); final JLabel byLabel = new JLabel("by"); gridLabel.setEnabled(false); byLabel.setEnabled(false); gridXSpinner_.setEnabled(false); gridYSpinner_.setEnabled(false); final JButton createGridButton = new JButton("Create"); createGridButton.setEnabled(false); createGridButton.addActionListener( new ActionListener() { @Override public void actionPerformed(ActionEvent e) { createGrid(); } }); newGridButton_ = new JToggleButton("New grid"); buttonPanel.add(new JLabel(" ")); buttonPanel.add(newGridButton_); newGridButton_.addActionListener( new ActionListener() { @Override public void actionPerformed(ActionEvent e) { if (newGridButton_.isSelected()) { makeGridOverlay( vad_.getImagePlus().getWidth() / 2, vad_.getImagePlus().getHeight() / 2); newGridButton_.setText("Cancel"); gridLabel.setEnabled(true); byLabel.setEnabled(true); gridXSpinner_.setEnabled(true); gridYSpinner_.setEnabled(true); createGridButton.setEnabled(true); } else { vad_.getImagePlus().getOverlay().clear(); vad_.getImagePlus().getCanvas().repaint(); newGridButton_.setText("New grid"); gridLabel.setEnabled(false); byLabel.setEnabled(false); gridXSpinner_.setEnabled(false); gridYSpinner_.setEnabled(false); createGridButton.setEnabled(false); } } }); buttonPanel.add(gridXSpinner_); buttonPanel.add(byLabel); buttonPanel.add(gridYSpinner_); buttonPanel.add(gridLabel); buttonPanel.add(createGridButton); // text area zPosLabel_ = new JLabel("Z position: "); textPanel.add(zPosLabel_); timeStampLabel_ = new JLabel("Elapsed time: "); textPanel.add(timeStampLabel_); fpsField_ = new JTextField(); fpsField_.setText("7"); fpsField_.setToolTipText("Set the speed at which the acquisition is played back."); fpsField_.setPreferredSize(new Dimension(25, 18)); fpsField_.addFocusListener( new java.awt.event.FocusAdapter() { public void focusLost(java.awt.event.FocusEvent evt) { updateFPS(); } }); fpsField_.addKeyListener( new java.awt.event.KeyAdapter() { public void keyReleased(java.awt.event.KeyEvent evt) { updateFPS(); } }); JLabel fpsLabel = new JLabel("Animation playback FPS: "); textPanel.add(fpsLabel); textPanel.add(fpsField_); textLayout.putConstraint(SpringLayout.WEST, textPanel, 0, SpringLayout.WEST, zPosLabel_); textLayout.putConstraint( SpringLayout.EAST, zPosLabel_, 0, SpringLayout.WEST, timeStampLabel_); textLayout.putConstraint(SpringLayout.EAST, timeStampLabel_, 0, SpringLayout.WEST, fpsLabel); textLayout.putConstraint(SpringLayout.EAST, fpsLabel, 0, SpringLayout.WEST, fpsField_); textLayout.putConstraint(SpringLayout.EAST, fpsField_, 0, SpringLayout.EAST, textPanel); textLayout.putConstraint(SpringLayout.NORTH, fpsField_, 0, SpringLayout.NORTH, textPanel); textLayout.putConstraint(SpringLayout.NORTH, zPosLabel_, 3, SpringLayout.NORTH, textPanel); textLayout.putConstraint( SpringLayout.NORTH, timeStampLabel_, 3, SpringLayout.NORTH, textPanel); textLayout.putConstraint(SpringLayout.NORTH, fpsLabel, 3, SpringLayout.NORTH, textPanel); }
private void makeGUI() { // Set Frames properties this.setTitle("Search And Edit Student"); this.setSize(700, 500); this.setLocationRelativeTo(null); this.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE); // Add components to panel_1 FlowLayout layout = new FlowLayout(); layout.setAlignment(FlowLayout.LEFT); panel_1.setLayout(layout); panel_1.add(searchcombobox); panel_1.add(searchtextfield); panel_1.add(searchbutton); panel_1.add(allfieldcheckbox); panel_1.setBackground(Color.WHITE); // Add panel_1 to frame this.add(panel_1, BorderLayout.PAGE_START); // Add components to panel_2 panel_2.add(totalstudentlabel); panel_2.setBackground(Color.WHITE); // Add panel_2 to frame this.add(panel_2, BorderLayout.PAGE_END); // Add components to panel_3 panel_3.setLayout(new GridLayout(1, 0)); // Design panel_5 GridBagLayout gbl = new GridBagLayout(); GridBagConstraints c = new GridBagConstraints(); c.weightx = 1; c.weighty = 1; c.fill = GridBagConstraints.BOTH; panel_5.setLayout(gbl); c.gridx = 0; c.gridy = 0; c.gridheight = 4; c.gridwidth = GridBagConstraints.REMAINDER; panel_5.add(panel_3, c); c.gridx = 0; c.gridy = 5; c.gridheight = 2; c.gridwidth = GridBagConstraints.REMAINDER; panel_5.add(panel_4, c); // Add components to panel_4 panel_4.setLayout(new GridLayout(1, 2)); panel_4.add(panel_6); // Lower Left panel_4.add(panel_7); // Lower Right // Design panel 6 SpringLayout sl = new SpringLayout(); panel_6.setLayout(sl); sl.putConstraint(SpringLayout.WEST, feespayedlabel, 2, SpringLayout.WEST, panel_6); sl.putConstraint(SpringLayout.NORTH, feespayedlabel, 2, SpringLayout.NORTH, panel_6); sl.putConstraint(SpringLayout.WEST, addfeestextfield, 2, SpringLayout.EAST, feespayedlabel); sl.putConstraint(SpringLayout.NORTH, addfeestextfield, 2, SpringLayout.NORTH, panel_6); sl.putConstraint(SpringLayout.WEST, addfeesbutton, 2, SpringLayout.EAST, addfeestextfield); sl.putConstraint(SpringLayout.NORTH, addfeesbutton, 2, SpringLayout.NORTH, panel_6); sl.putConstraint(SpringLayout.WEST, feesduelabel, 2, SpringLayout.WEST, panel_6); sl.putConstraint(SpringLayout.NORTH, feesduelabel, 2, SpringLayout.SOUTH, addfeesbutton); sl.putConstraint(SpringLayout.WEST, totalfeeslabel, 2, SpringLayout.WEST, panel_6); sl.putConstraint(SpringLayout.NORTH, totalfeeslabel, 2, SpringLayout.SOUTH, feesduelabel); sl.putConstraint(SpringLayout.WEST, coursecombobox, 2, SpringLayout.WEST, panel_6); sl.putConstraint(SpringLayout.NORTH, coursecombobox, 3, SpringLayout.SOUTH, totalfeeslabel); sl.putConstraint(SpringLayout.WEST, spinner, 2, SpringLayout.EAST, coursecombobox); sl.putConstraint(SpringLayout.NORTH, spinner, 3, SpringLayout.SOUTH, totalfeeslabel); sl.putConstraint(SpringLayout.WEST, addcoursebutton, 2, SpringLayout.WEST, panel_6); sl.putConstraint(SpringLayout.NORTH, addcoursebutton, 3, SpringLayout.SOUTH, coursecombobox); panel_6.add(feespayedlabel); panel_6.add(addfeestextfield); panel_6.add(addfeesbutton); panel_6.add(feesduelabel); panel_6.add(totalfeeslabel); panel_6.add(coursecombobox); panel_6.add(spinner); panel_6.add(addcoursebutton); // Set panel 7 layout panel_7.setLayout(new GridLayout(1, 0)); panel_7.setBackground(Color.WHITE); // Add panel_5 to frame this.add(panel_5); update(); // Show frame this.validate(); this.setVisible(true); }
public Marketplace_Master() { this.setLayout(layout); for (int i = 0; i < textfield.length; i++) { label[i] = new JLabel(labels[i]); textfield[i] = new JTextField(20); this.add(label[i]); this.add(textfield[i]); textfield[i].addFocusListener(this); } label[5] = new JLabel(labels[5]); this.add(label[5]); combo = new JComboBox(trust); combo.setSelectedIndex(0); this.add(combo); this.setTextField(); layout.putConstraint(SpringLayout.WEST, label[0], 10, SpringLayout.WEST, this); layout.putConstraint(SpringLayout.NORTH, label[0], 10, SpringLayout.NORTH, this); layout.putConstraint(SpringLayout.WEST, textfield[0], 101, SpringLayout.EAST, label[0]); layout.putConstraint(SpringLayout.NORTH, textfield[0], 10, SpringLayout.NORTH, this); layout.putConstraint(SpringLayout.EAST, textfield[0], -10, SpringLayout.EAST, this); for (int i = 1; i < textfield.length; i++) { layout.putConstraint(SpringLayout.WEST, label[i], 10, SpringLayout.WEST, this); layout.putConstraint(SpringLayout.NORTH, label[i], 10, SpringLayout.SOUTH, textfield[i - 1]); layout.putConstraint(SpringLayout.WEST, textfield[i], 0, SpringLayout.WEST, textfield[i - 1]); layout.putConstraint( SpringLayout.NORTH, textfield[i], 10, SpringLayout.SOUTH, textfield[i - 1]); layout.putConstraint(SpringLayout.EAST, textfield[i], 0, SpringLayout.EAST, textfield[0]); } layout.putConstraint(SpringLayout.WEST, label[5], 5, SpringLayout.WEST, this); layout.putConstraint(SpringLayout.NORTH, label[5], 5, SpringLayout.SOUTH, textfield[4]); layout.putConstraint(SpringLayout.WEST, combo, 0, SpringLayout.WEST, textfield[4]); layout.putConstraint(SpringLayout.NORTH, combo, 5, SpringLayout.SOUTH, textfield[4]); layout.putConstraint(SpringLayout.EAST, combo, 0, SpringLayout.EAST, textfield[0]); layout.putConstraint(SpringLayout.SOUTH, this, 10, SpringLayout.SOUTH, combo); this.setVisible(false); }
private void initComponents() { contentPane = this.getContentPane(); SpringLayout layout = new SpringLayout(); contentPane.setLayout(layout); useImageButton = new JButton("Use Image"); clearLayoutButton = new JButton("Clear Layout"); loadLayoutButton = new JButton("Load Layout"); saveLayoutButton = new JButton("Save Layout"); dumpImagesButton = new JButton("Dump Box Images"); nameTextField = new JTextField(10); nameTextField.setEnabled(false); descTextField = new JTextField(10); descTextField.setEnabled(false); contentPane.add(useImageButton); layout.putConstraint(SpringLayout.WEST, useImageButton, 10, SpringLayout.WEST, contentPane); layout.putConstraint( SpringLayout.NORTH, useImageButton, 10 + 30 * 0, SpringLayout.NORTH, contentPane); contentPane.add(clearLayoutButton); layout.putConstraint(SpringLayout.WEST, clearLayoutButton, 10, SpringLayout.WEST, contentPane); layout.putConstraint( SpringLayout.NORTH, clearLayoutButton, 10 + 30 * 1, SpringLayout.NORTH, contentPane); contentPane.add(loadLayoutButton); layout.putConstraint(SpringLayout.WEST, loadLayoutButton, 10, SpringLayout.WEST, contentPane); layout.putConstraint( SpringLayout.NORTH, loadLayoutButton, 10 + 30 * 2, SpringLayout.NORTH, contentPane); contentPane.add(saveLayoutButton); layout.putConstraint(SpringLayout.WEST, saveLayoutButton, 10, SpringLayout.WEST, contentPane); layout.putConstraint( SpringLayout.NORTH, saveLayoutButton, 10 + 30 * 3, SpringLayout.NORTH, contentPane); contentPane.add(dumpImagesButton); layout.putConstraint(SpringLayout.WEST, dumpImagesButton, 10, SpringLayout.WEST, contentPane); layout.putConstraint( SpringLayout.NORTH, dumpImagesButton, 10 + 30 * 4, SpringLayout.NORTH, contentPane); contentPane.add(nameTextField); layout.putConstraint(SpringLayout.WEST, nameTextField, 10, SpringLayout.WEST, contentPane); layout.putConstraint( SpringLayout.NORTH, nameTextField, 10 + 30 * 5, SpringLayout.NORTH, contentPane); contentPane.add(descTextField); layout.putConstraint(SpringLayout.WEST, descTextField, 10, SpringLayout.WEST, contentPane); layout.putConstraint( SpringLayout.NORTH, descTextField, 10 + 30 * 6, SpringLayout.NORTH, contentPane); }
private JPanel getContentPanel(WizardData wzd) { JPanel contentPanel1 = new JPanel(); welcomeTitle = new JLabel(); contentPanel1.setLayout(new java.awt.BorderLayout()); welcomeTitle.setFont(new java.awt.Font("MS Sans Serif", Font.BOLD, 11)); welcomeTitle.setText("Please insert already existing language files!"); contentPanel1.add(welcomeTitle, BorderLayout.NORTH); // ------------------------------------------------------------------------ Container mainPanel = new JPanel(); SpringLayout layout = new SpringLayout(); mainPanel.setLayout(layout); JTextArea infoText = new JTextArea(); infoText.setLineWrap(false); infoText.setEditable(false); infoText.setFocusable(false); infoText.setBackground(mainPanel.getBackground()); infoText.append(TInfoText.runtime.getText("newwizard", "site2")); JDialog parent = null; if (wzd.getWizard() != null) { parent = wzd.getWizard().getDialog(); } table = new LanguageManagerPanel(TGlobal.projects.getCurrentProject(), parent, true); rescanButton.addActionListener(this); baseButton.addActionListener(this); // Create and add the components. mainPanel.add(infoText); mainPanel.add(baseLabel); mainPanel.add(baseField); mainPanel.add(baseButton); mainPanel.add(rescanButton); mainPanel.add(table); // infoText layout.putConstraint(SpringLayout.WEST, infoText, 5, SpringLayout.WEST, mainPanel); layout.putConstraint(SpringLayout.NORTH, infoText, 5, SpringLayout.NORTH, mainPanel); // baseLabel ------------------------------------------------------------- layout.putConstraint(SpringLayout.WEST, baseLabel, 0, SpringLayout.WEST, infoText); layout.putConstraint(SpringLayout.NORTH, baseLabel, 12, SpringLayout.SOUTH, infoText); // nameField layout.putConstraint(SpringLayout.WEST, baseField, 5, SpringLayout.EAST, baseLabel); layout.putConstraint(SpringLayout.NORTH, baseField, 10, SpringLayout.SOUTH, infoText); // baseButton layout.putConstraint(SpringLayout.WEST, baseButton, 5, SpringLayout.EAST, baseField); layout.putConstraint(SpringLayout.NORTH, baseButton, 7, SpringLayout.SOUTH, infoText); // rescanButton layout.putConstraint(SpringLayout.WEST, rescanButton, 5, SpringLayout.EAST, baseButton); layout.putConstraint(SpringLayout.NORTH, rescanButton, 7, SpringLayout.SOUTH, infoText); // table layout.putConstraint(SpringLayout.WEST, table, 5, SpringLayout.WEST, mainPanel); layout.putConstraint(SpringLayout.NORTH, table, 15, SpringLayout.SOUTH, baseField); // panel edges ------------------------------------------------------ layout.putConstraint(SpringLayout.EAST, mainPanel, 5, SpringLayout.EAST, infoText); layout.putConstraint(SpringLayout.SOUTH, mainPanel, 5, SpringLayout.SOUTH, table); layout.layoutContainer(mainPanel); contentPanel1.add(mainPanel, BorderLayout.CENTER); return contentPanel1; }
/** creates a JTextfield with JLabel (contains labelText) and an identifier id */ public TLangTextField(String labelText, int id, FieldPopup popup) { super(); // this.setOpaque( false ) ; this.setLayout(new OverlayLayout(this)); // this.setBorder( BorderFactory.createEtchedBorder()); listenerList = new EventListenerList(); // build the labeled textfield -------------------------------------------- textField = new IDTextField(id, popup) { public void paint(Graphics g) { super.paint(g); if (currentImage != null) { Graphics2D g2 = (Graphics2D) g; g2.drawImage(currentImage, -8, -2, this); } // System.out.println( "paint " +(counter++) ) ; } }; textField.addKeyListener(this); textField.addFocusListener(this); textField.setPopupName(labelText); textField.setMaximumSize(new Dimension(2000, 30)); textField.setFont(GUIGlobals.defaultLanguageFont); // charat position leerInsets = textField.getMargin(); label = new JLabel(labelText, JLabel.TRAILING); label.setLabelFor(textField); label.addFocusListener(this); // insert label and textfield layout = new SpringLayout(); bigPanel = new JPanel(layout); // bigPanel.setOpaque( false ) ; bigPanel.add(label); bigPanel.add(textField); // Adjust constraints for the label so it's at (5,5). layout.putConstraint(SpringLayout.WEST, label, 10, SpringLayout.WEST, bigPanel); layout.putConstraint(SpringLayout.NORTH, label, 6, SpringLayout.NORTH, bigPanel); // Adjust constraints for the text field so it's at // (<label's right edge> + 5, 5). layout.putConstraint(SpringLayout.WEST, textField, 10, SpringLayout.EAST, label); layout.putConstraint(SpringLayout.NORTH, textField, -2, SpringLayout.NORTH, label); // Adjust constraints for the content pane: Its right // edge should be 5 pixels beyond the text field's right // edge, and its bottom edge should be 5 pixels beyond // the bottom edge of the tallest component (which we'll // assume is textField). layout.putConstraint(SpringLayout.EAST, bigPanel, 5, SpringLayout.EAST, textField); layout.putConstraint( SpringLayout.SOUTH, bigPanel, // 8, // SpringLayout.SOUTH, label ) ; 5, SpringLayout.SOUTH, textField); // build image section ---------------------------------------------------- imageLabel = new JLabel(); imageLabel.setOpaque(false); fieldState = REQUIRE_STATE; setImage(); textField.other = imageLabel; // insert image and labeled-field ----------------------------------------- this.add(imageLabel); this.add(bigPanel); // pipe all focus events to local class methods super.addFocusListener(this); }
private static void createAndShowGUI() { JFrame frame = new JFrame("Fractal"); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); SpringLayout layout = new SpringLayout(); frame.setLayout(layout); Orientation nw = new Orientation(); nw.setOffset(0, 0); Orientation sw = new Orientation(); sw.setOffset(0, regionSize); Orientation se = new Orientation(); se.setOffset(regionSize, regionSize); Fractal fractal = new Fractal(regionSize); fractal.setOrientations(nw, sw, se); layout.putConstraint(SpringLayout.WEST, fractal, 5, SpringLayout.WEST, frame.getContentPane()); layout.putConstraint( SpringLayout.NORTH, fractal, 5, SpringLayout.NORTH, frame.getContentPane()); layout.putConstraint(SpringLayout.WEST, nw, 5, SpringLayout.EAST, fractal); layout.putConstraint(SpringLayout.NORTH, nw, 0, SpringLayout.NORTH, fractal); layout.putConstraint(SpringLayout.NORTH, sw, 5, SpringLayout.SOUTH, nw); layout.putConstraint(SpringLayout.WEST, sw, 0, SpringLayout.WEST, nw); layout.putConstraint(SpringLayout.NORTH, se, 5, SpringLayout.SOUTH, nw); layout.putConstraint(SpringLayout.WEST, se, 5, SpringLayout.EAST, sw); layout.putConstraint( SpringLayout.SOUTH, frame.getContentPane(), 5, SpringLayout.SOUTH, fractal); layout.putConstraint(SpringLayout.EAST, frame.getContentPane(), 5, SpringLayout.EAST, se); frame.add(nw); frame.add(sw); frame.add(se); frame.add(fractal); frame.setResizable(false); frame.pack(); frame.setVisible(true); }
private void initRound() { SpringLayout mainLayout = new SpringLayout(); setLayout(mainLayout); resultButton.setEnabled(false); betButton.setEnabled(true); inputImage.add(betInput); controlPanel.add(betLabel); controlPanel.add(inputImage); controlPanel.add(betButton); add(recordLabel); add(record); add(dealerPanel); add(playerPanel); add(controlPanel); add(moneyLabel); add(money); add(resultButton); mainLayout.putConstraint(SpringLayout.WEST, recordLabel, 154, SpringLayout.WEST, this); mainLayout.putConstraint(SpringLayout.NORTH, recordLabel, 20, SpringLayout.NORTH, this); mainLayout.putConstraint(SpringLayout.NORTH, record, 15, SpringLayout.NORTH, this); mainLayout.putConstraint(SpringLayout.WEST, record, 20, SpringLayout.EAST, recordLabel); mainLayout.putConstraint(SpringLayout.WEST, dealerPanel, 180, SpringLayout.WEST, this); mainLayout.putConstraint(SpringLayout.NORTH, dealerPanel, 70, SpringLayout.NORTH, this); mainLayout.putConstraint(SpringLayout.WEST, playerPanel, 180, SpringLayout.WEST, this); mainLayout.putConstraint(SpringLayout.NORTH, playerPanel, 10, SpringLayout.SOUTH, dealerPanel); mainLayout.putConstraint(SpringLayout.SOUTH, moneyLabel, -20, SpringLayout.SOUTH, this); mainLayout.putConstraint(SpringLayout.WEST, moneyLabel, 5, SpringLayout.WEST, this); mainLayout.putConstraint(SpringLayout.WEST, money, 20, SpringLayout.EAST, moneyLabel); mainLayout.putConstraint(SpringLayout.SOUTH, money, -15, SpringLayout.SOUTH, this); mainLayout.putConstraint(SpringLayout.SOUTH, resultButton, -13, SpringLayout.SOUTH, this); mainLayout.putConstraint(SpringLayout.EAST, resultButton, -70, SpringLayout.EAST, this); mainLayout.putConstraint( SpringLayout.SOUTH, controlPanel, -5, SpringLayout.NORTH, resultButton); assignCards(); numReplaced = 0; betInput.setText(null); betInput.requestFocusInWindow(); }