Java Code Examples for org.jdesktop.swingx.HorizontalLayout

The following examples show how to use org.jdesktop.swingx.HorizontalLayout. These examples are extracted from open source projects. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source Project: arcusplatform   Source File: ResetPasswordWizard.java    License: Apache License 2.0 4 votes vote down vote up
protected JPanel createContents() {
   ButtonGroup group = new ButtonGroup();
   group.add(email);
   group.add(phone);
   submit.addActionListener((e) -> this.submit());

   JPanel panel = new JPanel();
   panel.setLayout(new GridBagLayout());

   GridBagConstraints labels = new GridBagConstraints();
   labels.gridy = 0;
   labels.fill = GridBagConstraints.NONE;
   labels.anchor = GridBagConstraints.EAST;

   GridBagConstraints fields = new GridBagConstraints();
   fields.gridy = 0;
   fields.fill = GridBagConstraints.HORIZONTAL;
   fields.weightx = 1;
   
   panel.add(new JLabel("Username:"), labels.clone());
   panel.add(username, fields.clone());
   labels.gridy++;
   fields.gridy++;

   GridBagConstraints buttons = new GridBagConstraints();
   buttons.gridy = labels.gridy + 1;
   buttons.weightx = 1.0;
   buttons.fill = GridBagConstraints.HORIZONTAL;
   buttons.anchor = GridBagConstraints.NORTHEAST;
   buttons.gridwidth = 2;

   JPanel selectorPanel = new JPanel();
   selectorPanel.setLayout(new VerticalLayout());
   selectorPanel.setBorder(BorderFactory.createTitledBorder("Notify me by:"));
   selectorPanel.add(email);
   selectorPanel.add(phone);
   panel.add(selectorPanel, buttons.clone());
   buttons.gridy++;


   buttons.weighty = 1.0;
   buttons.fill = GridBagConstraints.NONE;
   
   JPanel buttonPanel = new JPanel();
   buttonPanel.setLayout(new HorizontalLayout());

   buttonPanel.add(submit);
   panel.add(buttonPanel, buttons.clone());

   return panel;
}
 
Example 2
Source Project: arcusplatform   Source File: ResetPasswordWizard.java    License: Apache License 2.0 4 votes vote down vote up
protected JPanel createContents() {
   Oculus.invokeOnEnter(code, () -> this.submit());
   Oculus.invokeOnEnter(password, () -> this.submit());
   submit.addActionListener((e) -> this.submit());
   back.addActionListener((e) -> this.back());

   JPanel panel = new JPanel();
   panel.setLayout(new GridBagLayout());

   GridBagConstraints labels = new GridBagConstraints();
   labels.gridy = 0;
   labels.fill = GridBagConstraints.NONE;
   labels.anchor = GridBagConstraints.EAST;

   GridBagConstraints fields = new GridBagConstraints();
   fields.gridy = 0;
   fields.fill = GridBagConstraints.HORIZONTAL;
   fields.weightx = 1;
   
   panel.add(new JLabel("Code:"), labels.clone());
   panel.add(code, fields.clone());
   labels.gridy++;
   fields.gridy++;

   panel.add(new JLabel("New Password:"), labels.clone());
   panel.add(password, fields.clone());
   labels.gridy++;
   fields.gridy++;

   GridBagConstraints buttons = new GridBagConstraints();
   buttons.gridy = labels.gridy + 1;
   buttons.weightx = 1.0;
   buttons.weighty = 1.0;
   buttons.fill = GridBagConstraints.NONE;
   buttons.anchor = GridBagConstraints.NORTHEAST;
   buttons.gridwidth = 2;

   JPanel buttonPanel = new JPanel();
   buttonPanel.setLayout(new HorizontalLayout());

   buttonPanel.add(back);
   buttonPanel.add(submit);
   panel.add(buttonPanel, buttons.clone());

   return panel;
}
 
Example 3
Source Project: arcusplatform   Source File: ChangePasswordDialog.java    License: Apache License 2.0 4 votes vote down vote up
protected JPanel createContents() {
   login.addActionListener((e) -> this.submit());
   Oculus.invokeOnEnter(oldPassword, () -> this.submit());
   Oculus.invokeOnEnter(newPassword, () -> this.submit());

   JPanel panel = new JPanel();
   panel.setLayout(new GridBagLayout());

   GridBagConstraints labels = new GridBagConstraints();
   labels.gridy = 0;
   labels.fill = GridBagConstraints.NONE;
   labels.anchor = GridBagConstraints.EAST;

   GridBagConstraints fields = new GridBagConstraints();
   fields.gridy = 0;
   fields.fill = GridBagConstraints.HORIZONTAL;
   fields.weightx = 1;

   panel.add(new JLabel("Old Password"), labels.clone());
   panel.add(oldPassword, fields.clone());
   labels.gridy++;
   fields.gridy++;

   panel.add(new JLabel("New Password"), labels.clone());
   panel.add(newPassword, fields.clone());
   labels.gridy++;
   fields.gridy++;

   JPanel buttonPanel = new JPanel();
   buttonPanel.setLayout(new HorizontalLayout());
   GridBagConstraints buttons = new GridBagConstraints();
   buttons.gridy = labels.gridy + 1;
   buttons.anchor = GridBagConstraints.NORTHEAST;
   buttons.gridwidth = 2;
   buttons.weighty = 1.0;

   buttonPanel.add(login);
   panel.add(buttonPanel, buttons);

   return panel;
}
 
Example 4
Source Project: arcusplatform   Source File: CreatePersonDialog.java    License: Apache License 2.0 4 votes vote down vote up
@Override
     protected JPanel createContents() {
      JPanel panel = new JPanel();
      panel.setLayout(new GridBagLayout());

      GridBagConstraints labels = new GridBagConstraints();
      labels.gridy = 0;
      labels.fill = GridBagConstraints.NONE;
      labels.anchor = GridBagConstraints.EAST;

      GridBagConstraints fields = new GridBagConstraints();
      fields.gridy = 0;
      fields.fill = GridBagConstraints.HORIZONTAL;
      fields.weightx = 1;

      panel.add(new JLabel("Email"), labels.clone());
      panel.add(email, fields.clone());
      labels.gridy++;
      fields.gridy++;

      panel.add(new JLabel("First Name"), labels.clone());
      panel.add(firstName, fields.clone());
      labels.gridy++;
      fields.gridy++;

      panel.add(new JLabel("Last Name"), labels.clone());
      panel.add(lastName, fields.clone());
      labels.gridy++;
      fields.gridy++;

      panel.add(new JLabel("Mobile Number"), labels.clone());
      panel.add(mobileNumber, fields.clone());
      labels.gridy++;
      fields.gridy++;

      panel.add(new JSeparator(SwingConstants.HORIZONTAL), labels.clone());
      labels.gridy++;
      fields.gridy++;

      // commented out because halflings don't have passwords
      /*
      panel.add(Box.createHorizontalBox(), labels.clone());
      panel.add(new JLabel("If user is to allowed to login, enter a password."), fields.clone());
      labels.gridy++;
      fields.gridy++;

      panel.add(new JLabel("Password"), labels.clone());
      panel.add(password, fields.clone());
      labels.gridy++;
      fields.gridy++;
      */

      JPanel buttonPanel = new JPanel();
      buttonPanel.setLayout(new HorizontalLayout());
      GridBagConstraints buttons = new GridBagConstraints();
      buttons.gridy = labels.gridy + 1;
      buttons.anchor = GridBagConstraints.NORTHEAST;
      buttons.gridwidth = 2;
      buttons.weighty = 1.0;

      buttonPanel.add(new JButton(new AbstractAction("Cancel") {
	@Override
	public void actionPerformed(ActionEvent e) {
		CreatePersonDialogImpl.this.dispose();
	}
}));
      buttonPanel.add(new JButton(submitAction("Create User")));
      panel.add(buttonPanel, buttons);

      return panel;
   }
 
Example 5
Source Project: arcusplatform   Source File: RecordDialog.java    License: Apache License 2.0 4 votes vote down vote up
@Override
protected JPanel createContents() {
   JPanel panel = new JPanel();
   panel.setLayout(new GridBagLayout());

   GridBagConstraints labels = new GridBagConstraints();
   labels.gridy = 0;
   labels.fill = GridBagConstraints.NONE;
   labels.anchor = GridBagConstraints.EAST;

   GridBagConstraints fields = new GridBagConstraints();
   fields.gridy = 0;
   fields.fill = GridBagConstraints.HORIZONTAL;
   fields.weightx = 1;

   panel.add(new JLabel("Camera Address"), labels.clone());
   panel.add(cameraAddress, fields.clone());
   labels.gridy++;
   fields.gridy++;

   panel.add(new JLabel("Stream"), labels.clone());
   panel.add(stream, fields.clone());
   labels.gridy++;
   fields.gridy++;

   JPanel buttonPanel = new JPanel();
   buttonPanel.setLayout(new HorizontalLayout());
   GridBagConstraints buttons = new GridBagConstraints();
   buttons.gridy = labels.gridy + 1;
   buttons.anchor = GridBagConstraints.NORTHEAST;
   buttons.gridwidth = 2;
   buttons.weighty = 1.0;

   buttonPanel.add(new JButton(new AbstractAction("Cancel") {
      @Override
      public void actionPerformed(ActionEvent e) {
         RecordDialogImpl.this.dispose();
      }
   }));
   buttonPanel.add(new JButton(submitAction("Start")));
   panel.add(buttonPanel, buttons);

   return panel;
}