Java Code Examples for java.awt.GridBagConstraints#NORTHEAST

The following examples show how to use java.awt.GridBagConstraints#NORTHEAST . 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 File: HubIdPrompt.java    From arcusplatform with Apache License 2.0 6 votes vote down vote up
protected JPanel createContents() {
   submit.addActionListener((e) -> this.submit());
   Oculus.invokeOnEnter(hubId, () -> this.submit());

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

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

   panel.add(instructions, gbc.clone());
   gbc.gridy++;

   panel.add(hubId, gbc.clone());
   gbc.gridy++;
   gbc.anchor = GridBagConstraints.NORTHEAST;
   gbc.weighty = 1.0;
   gbc.fill = GridBagConstraints.NONE;

   panel.add(submit, gbc.clone());

   return panel;
}
 
Example 2
Source File: BalloonManager.java    From netbeans with Apache License 2.0 5 votes vote down vote up
void setArrowLocation( int arrowLocation) {
    this.arrowLocation = arrowLocation;
    if( arrowLocation == GridBagConstraints.NORTHEAST || arrowLocation == GridBagConstraints.NORTHWEST ) {
        setBorder( BorderFactory.createEmptyBorder(0, 0, Y_OFFSET, btnDismiss.getWidth()));
    } else {
        setBorder( BorderFactory.createEmptyBorder(Y_OFFSET, 0, 0, btnDismiss.getWidth()));
    }
}
 
Example 3
Source File: PilotPanel.java    From megamek with GNU General Public License v2.0 5 votes vote down vote up
PilotPanel(final UnitDisplay unitDisplay) {
    setLayout(new GridBagLayout());
    GridBagConstraints gbc = new GridBagConstraints();
    gbc.insets = new Insets(minTopMargin, minLeftMargin, minTopMargin, minLeftMargin);
    gbc.anchor = GridBagConstraints.NORTHEAST;
    gbc.gridx = 0;
    gbc.gridy = 0;
    gbc.weightx = 1.0;
    add(cbCrewSlot, gbc);
    cbCrewSlot.addActionListener(e -> selectCrewSlot());
    
    btnSwapRoles.setToolTipText(Messages.getString("PilotMapSet.swapRoles.toolTip"));
    gbc.gridy = 1;
    add(btnSwapRoles, gbc);
    btnSwapRoles.addActionListener(e -> {
        if (null != entity) {
            entity.getCrew().setSwapConsoleRoles(btnSwapRoles.isSelected());
            unitDisplay.getClientGUI().getClient().sendUpdateEntity(entity);
            updateSwapButtonText();
        }
    });
    
    //Hack to keep controls at the top of the screen when the bottom one is not always visible.
    //There is probably a better way to do this.
    gbc.gridy = 2;
    gbc.weighty = 1.0;
    add(new JLabel(), gbc);
    
    pi = new PilotMapSet(this);
    addElement(pi.getContentGroup());
    Enumeration<BackGroundDrawer> iter = pi.getBackgroundDrawers()
                                           .elements();
    while (iter.hasMoreElements()) {
        addBgDrawer(iter.nextElement());
    }
    onResize();
}
 
Example 4
Source File: SpideeControlPanel.java    From Robot-Overlord-App with GNU General Public License v2.0 5 votes vote down vote up
private CollapsiblePanel createSpeedPanel() {
	CollapsiblePanel speedPanel = new CollapsiblePanel("Speed");
	GridBagConstraints con2 = PanelHelper.getDefaultGridBagConstraints();
	con2.weighty=1;
	con2.weightx=0.25;

	double speed=robot.speed_scale;
	int speedIndex;
	for(speedIndex=0;speedIndex<speedOptions.length;++speedIndex) {
		if( speedOptions[speedIndex] >= speed )
			break;
	}
	
	speedNow = new JLabel(Double.toString(speedOptions[speedIndex]),JLabel.CENTER);
	java.awt.Dimension dim = speedNow.getPreferredSize();
	dim.width = 50;
	speedNow.setPreferredSize(dim);
	speedPanel.getContentPane().add(speedNow,con2);

	speedControl = new JSlider(0,speedOptions.length-1,speedIndex);
	speedControl.addChangeListener(this);
	speedControl.setMajorTickSpacing(speedOptions.length-1);
	speedControl.setMinorTickSpacing(1);
	speedControl.setPaintTicks(true);
	con2.anchor=GridBagConstraints.NORTHEAST;
	con2.fill=GridBagConstraints.HORIZONTAL;
	con2.weightx=0.75;
	con2.gridx=1;
	speedPanel.getContentPane().add(speedControl,con2);

	return speedPanel;
}
 
Example 5
Source File: LogDetailsPanel.java    From aion-germany with GNU General Public License v3.0 5 votes vote down vote up
public LogDetailsPanel(String name)
{
    _saveButton.setEnabled(false);
    this.setBorder(BorderFactory.createCompoundBorder(
            BorderFactory.createTitledBorder(name),
            BorderFactory.createEmptyBorder(2,2,2,2)));
    
    this.setLayout(new GridBagLayout());
    GridBagConstraints cons = new GridBagConstraints();
    
    _saveButton.addActionListener(new SaveButtonListener());
    _saveButton.setActionCommand("save");
    
    cons.insets = new Insets(2,2,2,2);
    cons.anchor = GridBagConstraints.NORTHWEST;
    this.add(_fileNameLabel, cons);
    cons.gridx = 1;
    cons.anchor = GridBagConstraints.NORTHEAST;
    this.add(_saveButton, cons);
    cons.fill = GridBagConstraints.BOTH;
    cons.anchor = GridBagConstraints.NORTHWEST;
    cons.gridx = 0;
    cons.gridy = 1;
    this.add(_fileStatusLabel, cons);
    cons.gridy = 2;
    this.add(_fileInfoLabel, cons);
    
    cons.weighty = 0.5;
    cons.gridy = 3;
    cons.gridheight = 5;
    this.add(new JScrollPane(_commentEditor), cons);
}
 
Example 6
Source File: ChangePinDialog.java    From arcusplatform with Apache License 2.0 5 votes vote down vote up
@Override
protected JPanel createContents() {
   submit.addActionListener((e) -> this.submit());
   Oculus.invokeOnEnter(newPin.getComponent(), () -> this.submit());

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

   GridBagConstraints gbc = new GridBagConstraints();
   gbc.gridy = 0;
   gbc.gridx = 0;
   gbc.weightx = 0;
   gbc.fill = GridBagConstraints.NONE;
   panel.add(newPin.getLabel(), gbc.clone());

   gbc.gridx = 1;
   gbc.weightx = 1.0;
   gbc.fill = GridBagConstraints.HORIZONTAL;
   panel.add(newPin.getComponent(), gbc.clone());

   gbc.gridy++;

   gbc.anchor = GridBagConstraints.NORTHEAST;
   gbc.weighty = 1.0;
   gbc.gridx = 1;
   gbc.fill = GridBagConstraints.NONE;

   panel.add(submit, gbc.clone());

   return panel;
}
 
Example 7
Source File: PropertiesUi.java    From triplea with GNU General Public License v3.0 5 votes vote down vote up
private void addItem(
    final String labelText, final JComponent item, final String tooltip, final int rowsNeeded) {
  // Create the label and its constraints
  final JLabel label = new JLabel(labelText);
  final GridBagConstraints labelConstraints = new GridBagConstraints();
  labelConstraints.gridx = labelColumn;
  labelConstraints.gridy = nextRow;
  labelConstraints.gridheight = rowsNeeded;
  labelConstraints.insets = new Insets(10, 10, 0, 0);
  labelConstraints.anchor = GridBagConstraints.NORTHEAST;
  labelConstraints.fill = GridBagConstraints.NONE;
  add(label, labelConstraints);
  // Add the component with its constraints
  final GridBagConstraints itemConstraints = new GridBagConstraints();
  itemConstraints.gridx = labelColumn + 1;
  itemConstraints.gridy = nextRow;
  itemConstraints.gridheight = rowsNeeded;
  itemConstraints.insets = new Insets(10, 10, 0, 10);
  itemConstraints.weightx = 1.0;
  itemConstraints.anchor = GridBagConstraints.WEST;
  itemConstraints.fill = GridBagConstraints.NONE;
  add(item, itemConstraints);
  if (tooltip != null && tooltip.length() > 0) {
    label.setToolTipText(tooltip);
    item.setToolTipText(tooltip);
  }
  nextRow += rowsNeeded;
}
 
Example 8
Source File: SelectNewPlacePrompt.java    From arcusplatform with Apache License 2.0 5 votes vote down vote up
@Override
protected Component createContents() {
   select.addActionListener((e) -> this.submit());

   JPanel panel = new JPanel();
   panel.setLayout(new GridBagLayout());
   GridBagConstraints gbc = new GridBagConstraints();
   gbc.gridx = 0;
   gbc.gridy = 0;
   gbc.fill = GridBagConstraints.NONE;
   gbc.anchor = GridBagConstraints.EAST;
   panel.add(header, gbc.clone());

   gbc.gridy++;
   gbc.anchor = GridBagConstraints.NORTHWEST;
   placeSelector.setPreferredSize(new Dimension(240, placeSelector.getPreferredSize().height));
   placeSelector.setMinimumSize(placeSelector.getPreferredSize());
   panel.add(placeSelector, gbc.clone());

   gbc.gridy++;
   gbc.gridx = 0;
   gbc.anchor = GridBagConstraints.NORTHEAST;
   gbc.weighty = 1;
   gbc.weightx = 0;
   panel.add(select, gbc.clone());

   gbc.gridy++;
   gbc.gridx = 0;
   gbc.anchor = GridBagConstraints.NORTHEAST;
   gbc.weighty = 1;
   gbc.weightx = 0;
   panel.add(select, gbc.clone());

   return panel;
}
 
Example 9
Source File: DeltaRobot3Panel.java    From Robot-Overlord-App with GNU General Public License v2.0 5 votes vote down vote up
protected CollapsiblePanel createSpeedPanel() {
	double speed=robot.getSpeed();
	int speedIndex;
	for(speedIndex=0;speedIndex<speedOptions.length;++speedIndex) {
		if( speedOptions[speedIndex] >= speed )
			break;
	}
	speedNow = new JLabel(Double.toString(speedOptions[speedIndex]),JLabel.CENTER);
	java.awt.Dimension dim = speedNow.getPreferredSize();
	dim.width = 50;
	speedNow.setPreferredSize(dim);

	CollapsiblePanel speedPanel = new CollapsiblePanel("Speed");

	GridBagConstraints con2 = PanelHelper.getDefaultGridBagConstraints();
	con2.weightx=0.25;
	speedPanel.getContentPane().add(speedNow,con2);

	speedControl = new JSlider(0,speedOptions.length-1,speedIndex);
	speedControl.addChangeListener(this);
	speedControl.setMajorTickSpacing(speedOptions.length-1);
	speedControl.setMinorTickSpacing(1);
	speedControl.setPaintTicks(true);
	con2.anchor=GridBagConstraints.NORTHEAST;
	con2.fill=GridBagConstraints.HORIZONTAL;
	con2.weightx=0.75;
	con2.gridx=1;
	speedPanel.getContentPane().add(speedControl,con2);
	
	return speedPanel;
}
 
Example 10
Source File: BillingInformationPrompt.java    From arcusplatform with Apache License 2.0 4 votes vote down vote up
@Override
protected Component createContents() {
   submit.addActionListener((e) -> this.submit());

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

   GridBagConstraints gbc = new GridBagConstraints();
   gbc.gridy = 0;
   addLabelAndInput(panel, ccLabel, cc, gbc);

   gbc.gridy++;
   addLabelAndInput(panel, monthLabel, month, gbc);

   gbc.gridy++;
   addLabelAndInput(panel, yearLabel, year, gbc);

   gbc.gridy++;
   addLabelAndInput(panel, ccvLabel, ccv, gbc);

   gbc.gridy++;
   addLabelAndInput(panel, address1Label, address1, gbc);

   gbc.gridy++;
   addLabelAndInput(panel, address2Label, address2, gbc);

   gbc.gridy++;
   addLabelAndInput(panel, cityLabel, city, 280, gbc);

   gbc.gridy++;
   addLabelAndInput(panel, stateProvLabel, stateProv, 280, gbc);

   gbc.gridy++;
   addLabelAndInput(panel, zipCodeLabel, zipCode, 140, gbc);

   gbc.gridy++;
   addLabelAndInput(panel, countryLabel, country, gbc);

   gbc.gridy++;
   addLabelAndInput(panel, firstNameLabel, firstName, 280, gbc);

   gbc.gridy++;
   addLabelAndInput(panel, lastNameLabel, lastName, 280, gbc);

   gbc.gridy++;
   addLabel(panel, note, gbc);

   gbc.gridy++;
   gbc.gridx = 1;
   gbc.anchor = GridBagConstraints.NORTHEAST;
   gbc.weighty = 1.0;
   gbc.fill = GridBagConstraints.NONE;
   panel.add(submit, gbc.clone());

   return panel;
}
 
Example 11
Source File: ChatLounge.java    From megamek with GNU General Public License v2.0 4 votes vote down vote up
private void setupMainPanel() {
    setupMap();

    panMain = new JPanel();

    // layout
    GridBagLayout gridbag = new GridBagLayout();
    GridBagConstraints c = new GridBagConstraints();
    panMain.setLayout(gridbag);

    c.fill = GridBagConstraints.VERTICAL;
    c.insets = new Insets(1, 1, 1, 1);
    c.gridx = 0;
    c.gridy = 0;
    c.weightx = 0.0;
    c.weighty = 0.0;
    c.gridwidth = 1;
    gridbag.setConstraints(butOptions, c);
    panMain.add(butOptions);

    JPanel panel1 = new JPanel(new GridBagLayout());
    c.fill = GridBagConstraints.HORIZONTAL;
    c.gridx = 0;
    c.gridy = 0;
    c.weightx = 1;
    c.weighty = 0.0;
    c.anchor = GridBagConstraints.WEST;
    panel1.add(lblMapSummary, c);
    c.anchor = GridBagConstraints.WEST;
    c.gridx = 1;
    c.weightx = 0;
    c.fill = GridBagConstraints.NONE;
    c.insets = new Insets(0, 0, 0, 20);
    panel1.add(lblGameYear, c);
    c.gridx = 2;
    panel1.add(lblTechLevel, c);
    c.insets = new Insets(0, 0, 0, 0);
    c.fill = GridBagConstraints.VERTICAL;
    c.gridx = 3;
    c.gridy = 0;
    c.weightx = 0;
    c.weighty = 0.0;
    c.anchor = GridBagConstraints.NORTHEAST;
    panel1.add(butCompact, c);

    c.fill = GridBagConstraints.HORIZONTAL;
    c.gridx = 1;
    c.gridy = 0;
    c.weightx = 0.0;
    c.weighty = 0.0;
    c.gridwidth = 1;
    c.anchor = GridBagConstraints.NORTHEAST;
    panMain.add(panel1, c);

    c.fill = GridBagConstraints.BOTH;
    c.gridx = 1;
    c.gridy = 1;
    c.weightx = 1.0;
    c.weighty = 1.0;
    c.gridwidth = 1;
    c.gridheight = 3;
    gridbag.setConstraints(scrEntities, c);
    panMain.add(scrEntities);

    c.fill = GridBagConstraints.HORIZONTAL;
    c.gridx = 0;
    c.gridy = 1;
    c.weightx = 0.0;
    c.weighty = 0.0;
    c.gridwidth = 1;
    c.gridheight = 1;
    c.anchor = GridBagConstraints.NORTHWEST;
    gridbag.setConstraints(panUnitInfo, c);
    panMain.add(panUnitInfo);

    c.fill = GridBagConstraints.HORIZONTAL;
    c.gridx = 0;
    c.gridy = 2;
    c.weightx = 0.0;
    c.weighty = 0.0;
    c.gridwidth = 1;
    c.gridheight = 1;
    gridbag.setConstraints(panPlayerInfo, c);
    panMain.add(panPlayerInfo);

    c.fill = GridBagConstraints.BOTH;
    c.gridx = 0;
    c.gridy = 3;
    c.weightx = 0.0;
    c.weighty = 1.0;
    c.gridwidth = 1;
    c.gridheight = 1;
    gridbag.setConstraints(scrPlayers, c);
    panMain.add(scrPlayers);

    panTabs.add("Select Units", panMain); //$NON-NLS-1$
    panTabs.add("Select Map", panMap); //$NON-NLS-1$
}
 
Example 12
Source File: AddPlacePrompt.java    From arcusplatform with Apache License 2.0 4 votes vote down vote up
@Override
protected Component createContents() {
   submit.addActionListener((e) -> this.submit());

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

   GridBagConstraints gbc = new GridBagConstraints();
   gbc.gridy = 0;
   addLabelAndInput(panel, nameLabel, name, gbc);

   gbc.gridy++;
   addLabelAndInput(panel, serviceLevelLabel, serviceLevel, gbc);

   gbc.gridy++;
   addLabelAndInput(panel, serviceAddonsLabel, serviceAddons, gbc);

   gbc.gridy++;
   addLabelAndInput(panel, address1Label, address1, gbc);

   gbc.gridy++;
   addLabelAndInput(panel, address2Label, address2, gbc);

   gbc.gridy++;
   addLabelAndInput(panel, cityLabel, city, 280, gbc);

   gbc.gridy++;
   addLabelAndInput(panel, stateProvLabel, stateProv, 280, gbc);

   gbc.gridy++;
   addLabelAndInput(panel, zipCodeLabel, zipCode, 140, gbc);

   gbc.gridy++;
   addLabelAndInput(panel, zipPlus4Label, zipPlus4, 120, gbc);

   gbc.gridy++;
   addLabelAndInput(panel, zipTypeLabel, zipType, 120, gbc);

   gbc.gridy++;
   addLabelAndInput(panel, countryLabel, country, gbc);

   gbc.gridy++;
   addLabelAndInput(panel, countyLabel, county, 280, gbc);

   gbc.gridy++;
   addLabelAndInput(panel, countyFipsLabel, countyFips, 160, gbc);

   gbc.gridy++;
   addLabelAndInput(panel, addrRdiLabel, addrRdi, 120, gbc);

   gbc.gridy++;
   addLabelAndInput(panel, addrValidatedLabel, addrValidated, gbc);

   gbc.gridy++;
   addLabelAndInput(panel, addrTypeLabel, addrType, 180, gbc);

   gbc.gridy++;
   addLabelAndInput(panel, tzNameLabel, tzName, 280, gbc);

   gbc.gridy++;
   addLabelAndInput(panel, tzOffsetLabel, tzOffset, 120, gbc);

   gbc.gridy++;
   addLabelAndInput(panel, tzUsesDSTLabel, tzUsesDST, gbc);

   gbc.gridy++;
   addLabelAndInput(panel, latitudeLabel, latitude, 160, gbc);

   gbc.gridy++;
   addLabelAndInput(panel, longitudeLabel, longitude, 160, gbc);

   gbc.gridy++;
   addLabelAndInput(panel, geoPrecisionLabel, geoPrecision, 120, gbc);

   gbc.gridy++;
   addLabel(panel, note, gbc);

   gbc.gridy++;
   gbc.gridx = 1;
   gbc.anchor = GridBagConstraints.NORTHEAST;
   gbc.weighty = 1.0;
   gbc.fill = GridBagConstraints.NONE;
   panel.add(submit, gbc.clone());

   return panel;
}
 
Example 13
Source File: ListSelector.java    From uima-uimaj with Apache License 2.0 4 votes vote down vote up
/**
 * Instantiates a new list selector.
 *
 * @param listData the list data
 */
public ListSelector(Object[] listData) {
  for (int i = 0; i < listData.length; i++)
    listModel.addElement(listData[i]);

  setLayout(new BorderLayout(4, 4));
  list = new JList(listModel);
  list.setFixedCellWidth(200);
  list.setVisibleRowCount(3);
  list.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
  Border etchedBorder = BorderFactory.createEtchedBorder();
  list.setBorder(etchedBorder);

  JScrollPane scrollPane = new JScrollPane(list, ScrollPaneConstants.VERTICAL_SCROLLBAR_ALWAYS,
          ScrollPaneConstants.HORIZONTAL_SCROLLBAR_ALWAYS);
  add(scrollPane, BorderLayout.CENTER);

  JPanel controlPanel = new JPanel();
  GridBagLayout gbl = new GridBagLayout();
  GridBagConstraints gbc = new GridBagConstraints();
  gbc.insets = new Insets(2, 2, 2, 2);
  controlPanel.setLayout(gbl);

  addField = new JTextField(6);
  addField.addActionListener(this);

  gbc.gridx = 0;
  gbc.gridy = 0;
  gbc.anchor = GridBagConstraints.NORTHEAST;
  controlPanel.add(addField, gbc);

  gbc.gridx = 1;
  gbc.anchor = GridBagConstraints.NORTHWEST;

  addButton = new SmallButton("Add");
  addButton.addActionListener(this);
  controlPanel.add(addButton, gbc);

  gbc.gridx = 0;
  gbc.gridy = 1;
  gbc.anchor = GridBagConstraints.WEST;

  JPanel movePanel = new JPanel();
  movePanel.setLayout(new GridLayout(1, 2, 4, 4));

  moveUpButton = new ImageButton(Images.UP);
  moveUpButton.addActionListener(this);
  movePanel.add(moveUpButton);

  moveDownButton = new ImageButton(Images.DOWN);
  moveDownButton.addActionListener(this);
  movePanel.add(moveDownButton);

  controlPanel.add(movePanel, gbc);

  gbc.gridx = 1;
  gbc.anchor = GridBagConstraints.WEST;

  gbc.anchor = GridBagConstraints.WEST;
  removeButton = new SmallButton("Remove");
  removeButton.addActionListener(this);
  controlPanel.add(removeButton, gbc);

  add(controlPanel, BorderLayout.EAST);
}
 
Example 14
Source File: HardLayoutPane.java    From DroidUIBuilder with Apache License 2.0 4 votes vote down vote up
/**
 * 按照指定的放置位置和占据的网格数,以指定的填充方式添加组件
 * 
 * @param willBeAddTo 要添加的组件
 * @param gridX 水平方向上网格位置
 * @param gridY 垂直方向上网格位置
 * @param gridWidth 水平方向上占据的网格个数
 * @param gridHeight 垂直方向上占据的网格个数
 * @param fill 填充方式
 * @see GridBagConstraints
 */
public Component addTo(Component willBeAddTo, int gridX, int gridY,
	int gridWidth, int gridHeight, int fill)
{
	gbc.gridx = gridX;
	gbc.gridy = gridY;
	gbc.gridwidth = gridWidth;
	gbc.gridheight = gridHeight;
	if (willBeAddTo instanceof javax.swing.JLabel &&
		((JLabel)willBeAddTo).getHorizontalAlignment() == javax.swing.JLabel.RIGHT)
	{
		gbc.anchor = GridBagConstraints.NORTHEAST;
	}
	else
	{
		gbc.anchor = GridBagConstraints.NORTHWEST;
	}
	switch (fill)
	{
		case GridBagConstraints.NONE:
			gbc.weightx = 0.0;
			gbc.weighty = 0.0;
			break;
		case GridBagConstraints.HORIZONTAL:
			gbc.weightx = 1.0;
			gbc.weighty = 0.0;
			break;
		case GridBagConstraints.VERTICAL:
			gbc.weightx = 0.0;
			gbc.weighty = 1.0;
			break;
		default:
			gbc.weightx = 1.0;
			gbc.weighty = 1.0;
	}
	gbc.fill = fill;
	
	//需要增加“回车移动焦点到下一组件上”监听事件
	if (addEnterKeyTrasfer)
		//给其它组件增加(文本组件已经UI里实现了
		addEnterKeyTransferFocusImplExceptText(willBeAddTo);
	this.fixedSubPane.add(willBeAddTo, gbc);
	return willBeAddTo;
}
 
Example 15
Source File: CreatePersonDialog.java    From arcusplatform with 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 16
Source File: RecordDialog.java    From arcusplatform with 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;
}
 
Example 17
Source File: ChangePasswordDialog.java    From arcusplatform with 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 18
Source File: ListItemBuilder.java    From raccoon4 with Apache License 2.0 4 votes vote down vote up
@Override
protected JPanel assemble() {
	icon = new JButton(new ImageIcon(image.getScaledInstance(48, 48,
			Image.SCALE_SMOOTH)));
	icon.addActionListener(this);
	checked = new JCheckBox();
	JLabel name = new JLabel(androidApp.getName());
	Font font = name.getFont();
	Font boldFont = new Font(font.getFontName(), Font.BOLD, font.getSize() + 2);
	name.setFont(boldFont);
	JLabel version = new JLabel(androidApp.getVersion());
	Font italic = new Font(font.getFontName(), Font.ITALIC, font.getSize());
	version.setFont(italic);

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

	gbc.gridx = 0;
	gbc.gridy = 0;
	gbc.anchor = GridBagConstraints.CENTER;
	gbc.fill = GridBagConstraints.NONE;
	gbc.insets.top = 5;
	gbc.insets.left = 5;
	gbc.insets.bottom = 5;
	gbc.insets.right = 5;
	gbc.weightx = 0;
	gbc.weighty = 0;
	gbc.gridheight = 3;
	panel.add(icon, gbc);

	gbc.gridx = 1;
	gbc.gridy = 0;
	gbc.anchor = GridBagConstraints.NORTHWEST;
	gbc.fill = GridBagConstraints.HORIZONTAL;
	gbc.insets.top = 10;
	gbc.insets.left = 0;
	gbc.insets.bottom = 0;
	gbc.insets.right = 0;
	gbc.weightx = 1;
	gbc.weighty = 0;
	gbc.gridheight = 1;
	panel.add(name, gbc);

	gbc.gridx = 1;
	gbc.gridy = 1;
	gbc.anchor = GridBagConstraints.NORTHWEST;
	gbc.fill = GridBagConstraints.HORIZONTAL;
	gbc.insets.top = 3;
	gbc.insets.left = 0;
	gbc.insets.bottom = 0;
	gbc.insets.right = 0;
	gbc.weightx = 0;
	gbc.weighty = 0;
	gbc.gridheight = 1;
	panel.add(version, gbc);

	gbc.gridx = 1;
	gbc.gridy = 2;
	gbc.anchor = GridBagConstraints.NORTHEAST;
	gbc.fill = GridBagConstraints.HORIZONTAL;
	gbc.insets.top = 3;
	gbc.insets.left = 0;
	gbc.insets.bottom = 0;
	gbc.insets.right = 0;
	gbc.weightx = 0;
	gbc.weighty = 0;
	gbc.gridheight = 1;
	panel.add(checked, gbc);

	return panel;
}
 
Example 19
Source File: ResetPasswordWizard.java    From arcusplatform with 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 20
Source File: ResetPasswordWizard.java    From arcusplatform with 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;
}