Java Code Examples for java.awt.GridBagConstraints#SOUTHEAST

The following examples show how to use java.awt.GridBagConstraints#SOUTHEAST . 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: BasePanel.java    From snowblossom with Apache License 2.0 5 votes vote down vote up
public void setup()
{
	setupPanel(); 

  GridBagConstraints c = new GridBagConstraints();
  c.gridheight = 1;
c.gridwidth = GridBagConstraints.REMAINDER;
  c.anchor = GridBagConstraints.WEST;

  c.weightx=0.0;
  c.weighty=0.0;

 panel.add(new JLabel("Status:"),c);	

  status_box.setEditable(false);
  panel.add(status_box,c);
 
  panel.add(new JLabel("Message:"),c);	

  message_box.setEditable(false);
  panel.add(message_box,c);
 
  c.anchor = GridBagConstraints.SOUTHEAST;
  c.weightx=1.0;
  c.weighty=1.0;
  panel.add(new JLabel("Snowblossom"),c);	
}
 
Example 2
Source File: StrokeMouseSmoothingDemo.java    From pumpernickel with MIT License 5 votes vote down vote up
DrawingPanel() {
	addMouseListener(mouseListener);
	addMouseMotionListener(mouseListener);
	setLayout(new GridBagLayout());
	GridBagConstraints c = new GridBagConstraints();
	c.gridx = 0;
	c.gridy = 0;
	c.weightx = 1;
	c.weighty = 1;
	c.fill = GridBagConstraints.NONE;
	c.anchor = GridBagConstraints.SOUTHEAST;
	c.insets = new Insets(5, 5, 5, 5);
	add(clearButton, c);

	clearButton.addActionListener(new ActionListener() {

		@Override
		public void actionPerformed(ActionEvent e) {
			shapes.clear();
			inputs.clear();
			refreshDrawingPanel();
		}

	});

	refreshDrawingPanel();
}
 
Example 3
Source File: TraceAnalysisGUI.java    From kieker with Apache License 2.0 5 votes vote down vote up
private void addAndLayoutComponents() {
	final GridBagLayout layout = new GridBagLayout();
	this.setLayout(layout);
	final GridBagConstraints gridBagConstraints = new GridBagConstraints();

	gridBagConstraints.gridwidth = GridBagConstraints.REMAINDER;
	gridBagConstraints.anchor = GridBagConstraints.NORTHWEST;
	gridBagConstraints.insets.set(5, 5, 5, 5);
	gridBagConstraints.gridx = 0;
	gridBagConstraints.gridy = 0;
	gridBagConstraints.weightx = 1.0;
	gridBagConstraints.weighty = 1.0;
	gridBagConstraints.fill = GridBagConstraints.BOTH;
	this.getContentPane().add(this.mainPanel, gridBagConstraints);

	gridBagConstraints.gridwidth = GridBagConstraints.RELATIVE;
	gridBagConstraints.anchor = GridBagConstraints.SOUTHWEST;
	gridBagConstraints.insets.set(5, 5, 5, 5);
	gridBagConstraints.gridx = 0;
	gridBagConstraints.gridy = 1;
	gridBagConstraints.fill = GridBagConstraints.NONE;
	this.getContentPane().add(this.previousButton, gridBagConstraints);

	gridBagConstraints.gridwidth = GridBagConstraints.REMAINDER;
	gridBagConstraints.anchor = GridBagConstraints.SOUTHEAST;
	gridBagConstraints.insets.set(5, 5, 5, 5);
	gridBagConstraints.weightx = 1.0;
	gridBagConstraints.weighty = 1.0;
	gridBagConstraints.gridx = 1;
	gridBagConstraints.gridy = 1;
	gridBagConstraints.fill = GridBagConstraints.NONE;
	this.getContentPane().add(this.nextButton, gridBagConstraints);
}
 
Example 4
Source File: CommandLine.java    From wildfly-core with GNU Lesser General Public License v2.1 5 votes vote down vote up
public CommandLine(DoOperationActionListener opListener) {
    setLayout(new GridBagLayout());
    GridBagConstraints gbc = new GridBagConstraints();
    gbc.gridwidth = 1;
    gbc.anchor = GridBagConstraints.WEST;
    gbc.fill = GridBagConstraints.NONE;
    gbc.insets = new Insets(0,0,0,5);
    add(new JLabel("cmd>"), gbc);

    cmdText.setBorder(new LineBorder(Color.BLACK));
    cmdText.setText("/");
    cmdText.setLineWrap(true);
    cmdText.setRows(1);

    gbc.fill = GridBagConstraints.HORIZONTAL;
    gbc.weightx = 100.0;
    add(cmdText, gbc);

    KeyStroke enterKey = KeyStroke.getKeyStroke(KeyEvent.VK_ENTER, 0, false);
    cmdText.getInputMap().put(enterKey, SUBMIT_ACTION);
    cmdText.getActionMap().put(SUBMIT_ACTION, opListener);

    JPanel submitPanel = new JPanel(new GridLayout(2,1));
    submitButton.addActionListener(opListener);
    submitButton.setToolTipText("Submit the command to the server.");
    submitPanel.add(submitButton);

    isVerbose.setToolTipText("Show the command's DMR request.");
    submitPanel.add(isVerbose);

    gbc.fill = GridBagConstraints.NONE;
    gbc.anchor = GridBagConstraints.SOUTHEAST;
    gbc.weightx = 1.0;
    add(submitPanel, gbc);
}
 
Example 5
Source File: IpDeviceRegistrationPrompt.java    From arcusplatform with Apache License 2.0 4 votes vote down vote up
@Override
protected Component createContents() {
   register.addActionListener((e) -> this.submit());
   
   JPanel panel = new JPanel();
   panel.setLayout(new GridBagLayout());
   
   GridBagConstraints gbc = new GridBagConstraints();
   gbc.gridy = 0;
   gbc.gridx = 0;
   gbc.gridwidth = 2;
   gbc.ipady = 20;
   gbc.fill = GridBagConstraints.HORIZONTAL;
   gbc.weightx = 1;
   panel.add(instructions, gbc.clone());
   
   gbc.gridy++;
   gbc.ipady = 5;
   gbc.gridx = 0;
   gbc.gridwidth = 1;
   panel.add(typeLabel, gbc.clone());
   gbc.gridx = 1;
   panel.add(deviceTypeCombo, gbc.clone());
   
   gbc.gridy++;
   gbc.gridx = 0;
   panel.add(idLabel, gbc.clone());
   gbc.gridx = 1;
   panel.add(idText, gbc.clone());
   
   gbc.gridy++;
   gbc.gridx = 0;
   panel.add(modelLabel, gbc.clone());
   gbc.gridx = 1;
   panel.add(modelText, gbc.clone());
   
   gbc.gridy++;
   gbc.gridx = 0;
   panel.add(serialLabel, gbc.clone());
   gbc.gridx = 1;
   panel.add(serialText, gbc.clone());
   
   gbc.gridy++;
   gbc.gridx = 1;
   gbc.anchor = GridBagConstraints.SOUTHEAST;
   gbc.weighty = 1.0;
   gbc.fill = GridBagConstraints.NONE;
   
   panel.add(register, gbc.clone());
   
   return panel;
}
 
Example 6
Source File: SelectTimezonePrompt.java    From arcusplatform with Apache License 2.0 4 votes vote down vote up
@Override
protected Component createContents() {
   selectedZone =
         new ComboBoxBuilder<TimeZone>()
            .withModel(timezones)
            .withRenderer((tz) -> {
               if(tz == null) {
                  return "<No Timezones Loaded>";
               }
               else {
                  return tz.getName();
               }
            })
            .noteditable()
            .create();
   
   header = new JLabel();
   header.setText("Select a timezone for your place");

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

   GridBagConstraints gbc = new GridBagConstraints();
   gbc.gridx = 0;
   gbc.gridy = 0;
   gbc.fill = GridBagConstraints.HORIZONTAL;
   gbc.anchor = GridBagConstraints.WEST;
   panel.add(header, gbc.clone());

   gbc.gridy++;
   gbc.weightx = 1.0;
   gbc.anchor = GridBagConstraints.NORTHWEST;
   panel.add(selectedZone, gbc.clone());
   
   gbc.gridy++;
   gbc.fill = GridBagConstraints.NONE;
   gbc.anchor = GridBagConstraints.SOUTHEAST;
   panel.add(new JButton(submitAction("Set Timezone")), gbc.clone());

   return panel;
}
 
Example 7
Source File: ConnectionEditDialog.java    From rapidminer-studio with GNU Affero General Public License v3.0 4 votes vote down vote up
/**
 * Opens the dialog in view or edit mode
 *
 * @param owner
 * 		the owner
 * @param holder
 * 		the connection holder
 * @param openInEditMode
 *        {@code true} for edit mode, {@code false} for view mode
 */
public ConnectionEditDialog(Window owner, ConnectionInformationHolder holder, boolean openInEditMode) {
	super(owner, getTitle(holder, openInEditMode), ModalityType.APPLICATION_MODAL);
	this.isTypeKnown = ConnectionHandlerRegistry.getInstance().isTypeKnown(holder.getConnectionType());
	this.editMode = openInEditMode && holder.isEditable() && isTypeKnown;
	this.holder = holder;
	this.gui = getEditGui(holder);
	this.setLayout(new GridBagLayout());
	setMinimumSize(DEFAULT_SIZE);
	setPreferredSize(DEFAULT_SIZE);


	GridBagConstraints gbc = new GridBagConstraints();
	//----------BIG PANEL------------
	// Set injected Fields
	// [Test connection]   [Create] [Cancel]
	gbc.weightx = 1;
	gbc.weighty = 1;
	gbc.gridwidth = 3;
	gbc.anchor = GridBagConstraints.LINE_START;
	gbc.fill = GridBagConstraints.BOTH;
	gbc.insets = new Insets(10, 10, 0, 10);
	mainGUI = createMainGUI();
	add(mainGUI, gbc);

	gbc.insets = new Insets(0, 0, 0, 0);
	gbc.gridy = 1;
	gbc.fill = GridBagConstraints.HORIZONTAL;
	gbc.weighty = 0;
	gbc.gridwidth = 1;
	gbc.insets = new Insets(18, 10, 10, 74);
	testConnectionPanel = new TestConnectionPanel(holder.getConnectionType(), gui::getConnection, this::processTestResult, holder.getConnectionInformation().getStatistics());
	add(testConnectionPanel, gbc);

	gbc.insets = new Insets(0, 0, 10, 10);
	// Give save full with to make alignable to the east
	gbc.weightx = 0;
	gbc.anchor = GridBagConstraints.SOUTHEAST;
	if (!openInEditMode) {
		JButton editButton = new JButton(new OpenEditConnectionAction(this, holder));
		editButton.setEnabled(holder.isEditable() && isTypeKnown);
		add(editButton, gbc);
	} else if (editMode) {
		add(new JButton(new SaveConnectionAction(this, gui, holder::getLocation, this::processTestResult, "save_connection")), gbc);
	}
	gbc.insets = new Insets(0, 0, 10, 10);
	CancelEditingAction cancelAction = new CancelEditingAction(this, editMode ? "cancel_connection_edit" : "close_connection_edit", () -> editMode && holder.hasChanged(gui.getConnection()));
	add(new JButton(cancelAction), gbc);

	// check changes on close
	setDefaultCloseOperation(DO_NOTHING_ON_CLOSE);
	addWindowListener(new WindowAdapter() {
		@Override
		public void windowClosing(WindowEvent e) {
			cancelAction.actionPerformed(null);
		}

	});
	// close dialog with ESC
	getRootPane().getInputMap(JComponent.WHEN_IN_FOCUSED_WINDOW)
			.put(KeyStroke.getKeyStroke(KeyEvent.VK_ESCAPE, 0, false), "CLOSE");
	getRootPane().getActionMap().put("CLOSE", cancelAction);

	setLocationRelativeTo(getOwner());
	SwingUtilities.invokeLater(() -> {
		pack();
		revalidate();
		repaint();
	});
}
 
Example 8
Source File: TableLayout.java    From EchoSim with Apache License 2.0 4 votes vote down vote up
private void parseSetting(GridBagConstraints gbc, String key, String val)
{
    int v;
    try
    {
        v = Integer.parseInt(val);
    }
    catch (NumberFormatException e)
    {
        v = 0;
    }
    if (key.equals("x") || key.equals("gridx"))
    {
        if (val.equals("."))
            gbc.gridx = currentX;
        else if (val.equals("+"))
            gbc.gridx = ++currentX;
        else
            gbc.gridx = v; 
    } 
    else if (key.equals("y") || key.equals("gridy"))
    {
        if (val.equals("."))
            gbc.gridy = currentY;
        else if (val.equals("+"))
            gbc.gridy = ++currentY;
        else
           gbc.gridy = v; 
    } 
    else if (key.equals("gridwidth") || key.equals("width"))
        gbc.gridwidth = v;
    else if (key.equals("gridheight") || key.equals("height"))
        gbc.gridheight = v;
    else if (key.equals("weightx"))
        gbc.weightx = v;
    else if (key.equals("weighty"))
        gbc.weighty = v;
    else if (key.equals("ipadx"))
        gbc.ipadx = v;
    else if (key.equals("ipady"))
        gbc.ipady = v;
    else if (key.equals("fill"))
    {
        if (val.equals("none"))
            gbc.fill = GridBagConstraints.NONE;
        else if (val.equals("horizontal") || val.equals("h"))
            gbc.fill = GridBagConstraints.HORIZONTAL;
        else if (val.equals("vertical") || val.equals("v"))
            gbc.fill = GridBagConstraints.VERTICAL;
        else if (val.equals("both") || val.equals("hv"))
            gbc.fill = GridBagConstraints.BOTH;
    }
    else if (key.equals("anchor"))
    {
        if (val.equals("center"))
            gbc.anchor = GridBagConstraints.CENTER;
        else if (val.equals("north") || val.equals("n"))
            gbc.anchor = GridBagConstraints.NORTH;
        else if (val.equals("northeast") || val.equals("ne"))
            gbc.anchor = GridBagConstraints.NORTHEAST;
        else if (val.equals("east") || val.equals("e"))
            gbc.anchor = GridBagConstraints.EAST;
        else if (val.equals("southeast") || val.equals("se"))
            gbc.anchor = GridBagConstraints.SOUTHEAST;
        else if (val.equals("south") || val.equals("s"))
            gbc.anchor = GridBagConstraints.SOUTH;
        else if (val.equals("southwest") || val.equals("sw"))
            gbc.anchor = GridBagConstraints.SOUTHWEST;
        else if (val.equals("west") || val.equals("w"))
            gbc.anchor = GridBagConstraints.WEST;
        else if (val.equals("northwest") || val.equals("nw"))
            gbc.anchor = GridBagConstraints.NORTHWEST;
    }
}
 
Example 9
Source File: ManualDownloadBuilder.java    From raccoon4 with Apache License 2.0 4 votes vote down vote up
@Override
protected JPanel assemble() {
	JPanel panel = new JPanel();
	panel.setLayout(new GridBagLayout());
	GridBagConstraints gbc = new GridBagConstraints();

	ActionLocalizer al = Messages.getLocalizer();
	download = new JButton(al.localize("appdownload"));

	ButtonGroup bg = new ButtonGroup();
	bg.add(free);
	bg.add(paid);
	free.setSelected(true);

	gbc.gridx = 0;
	gbc.gridy = 0;
	gbc.gridwidth = 1;
	gbc.fill = GridBagConstraints.BOTH;
	gbc.insets.right = 5;
	gbc.insets.bottom = 3;
	panel.add(new JLabel(Messages.getString(ID + ".packageid")), gbc);

	gbc.gridx = 1;
	gbc.gridy = 0;
	gbc.gridwidth = 2;
	gbc.insets.right = 0;
	panel.add(packId, gbc);

	gbc.gridx = 0;
	gbc.gridy = 1;
	gbc.gridwidth = 1;
	gbc.insets.right = 5;
	panel.add(new JLabel(Messages.getString(ID + ".versioncode")), gbc);

	gbc.gridx = 1;
	gbc.gridy = 1;
	gbc.gridwidth = 2;
	gbc.insets.right = 0;
	panel.add(versionCode, gbc);

	gbc.gridx = 0;
	gbc.gridy = 2;
	gbc.gridwidth = 1;
	gbc.insets.right = 5;
	//panel.add(new JLabel(Messages.getString(ID + ".offertype")), gbc);
	panel.add(Box.createGlue(), gbc);

	gbc.gridx = 1;
	gbc.gridy = 2;
	gbc.gridwidth = 2;
	gbc.insets.right = 0;
	panel.add(Box.createGlue(), gbc);

	gbc.gridx = 0;
	gbc.gridy = 3;
	gbc.gridwidth = 1;
	gbc.insets.right = 5;
	panel.add(new JLabel(Messages.getString(ID + ".flow")), gbc);

	gbc.gridx = 1;
	gbc.gridy = 3;
	gbc.gridwidth = 1;
	gbc.insets.right = 0;
	panel.add(free, gbc);

	gbc.gridx = 2;
	gbc.gridy = 3;
	gbc.gridwidth = 1;
	gbc.insets.right = 5;
	panel.add(paid, gbc);

	gbc.gridx = 2;
	gbc.gridy = 4;
	gbc.insets.right = 0;
	gbc.anchor = GridBagConstraints.SOUTHEAST;
	gbc.fill = GridBagConstraints.NONE;
	gbc.insets.top = 20;
	gbc.insets.bottom = 0;
	panel.add(download, gbc);

	download.addActionListener(this);

	globals.get(PlayManager.class).addPlayListener(this);
	return new DialogBuilder(panel)
			.withButtons(new ButtonBarBuilder().add(download))
			.withTitle(Messages.getString(ID + ".title"))
			.withSubTitle(Messages.getString(ID + ".subtitle")).build(globals);
}
 
Example 10
Source File: TaskImportDialog.java    From chipster with MIT License 4 votes vote down vote up
public TaskImportDialog(ClientApplication application, String title, ImportSession importSession, Operation importOperation, String okButtonText, String cancelButtonText, String skipButtonText, String noteText) throws MicroarrayException {
	super(Session.getSession().getFrames().getMainFrame(), true);

	this.application = application;
	this.importSession = importSession;
	this.importOperation = importOperation;
	this.setTitle("Import");
	this.setModal(true);
	this.setPreferredSize(new Dimension(500, 300));

	// initialise components
	titleLabel = new JLabel("<html><p style=" + VisualConstants.HTML_DIALOG_TITLE_STYLE + ">" + title + "</p></html>");
	descriptionLabel = new JLabel("<html>" + importOperation.getDescription() + "</html>");
	noteLabel = new JLabel("<html><p style=\"font-style:italic\">" + noteText + "</p></html>");

	folderNameCombo = new JComboBox(ImportUtils.getFolderNames(false).toArray());
	folderNameCombo.setEditable(true);

	okButton = new JButton(okButtonText);
	okButton.setPreferredSize(BUTTON_SIZE);
	okButton.addActionListener(this);

	skipButton = new JButton(skipButtonText);
	skipButton.setPreferredSize(BUTTON_SIZE);
	skipButton.addActionListener(this);

	cancelButton = new JButton(cancelButtonText);
	cancelButton.setPreferredSize(BUTTON_SIZE);
	cancelButton.addActionListener(this);

	ImportParameterPanel parameterPanel = new ImportParameterPanel(importOperation, null);

	JPanel keepButtonsRightPanel = new JPanel(new GridBagLayout());
	GridBagConstraints buttonConstraints = new GridBagConstraints();
	buttonConstraints.weightx = 1.0;
	buttonConstraints.weighty = 1.0;
	buttonConstraints.anchor = GridBagConstraints.EAST;
	buttonConstraints.insets.set(0, 0, 0, 8);
	keepButtonsRightPanel.add(cancelButton, buttonConstraints);
	if (importSession != null) {
		buttonConstraints.anchor = GridBagConstraints.CENTER;		
		keepButtonsRightPanel.add(skipButton, buttonConstraints);
	}
	buttonConstraints.gridx = GridBagConstraints.RELATIVE;
	buttonConstraints.insets.set(0, 0, 0, 0);
	keepButtonsRightPanel.add(okButton, buttonConstraints);
	
	
	// layout
	GridBagConstraints c = new GridBagConstraints();
	this.setLayout(new GridBagLayout());

	// title label
	c.weightx = 1.0;
	c.weighty = 1.0;
	c.fill = GridBagConstraints.HORIZONTAL;
	c.anchor = GridBagConstraints.NORTHWEST;
	c.insets.set(10, 10, 5, 10);
	c.gridx = 0;
	c.gridy = 0;
	this.add(titleLabel, c);

	// description label
	c.gridy++;
	this.add(descriptionLabel, c);
	
	// parameter panel
	c.gridy++;
	c.weighty = 120.0;
	c.fill = GridBagConstraints.BOTH;
	c.anchor = GridBagConstraints.NORTHWEST;
	c.insets.set(0, 10, 10, 10);
	this.add(parameterPanel, c);

	// note
	c.gridy++;
	c.weightx = 1.0;
	c.weighty = 1.0;
	c.insets.set(0, 10, 10, 10);
	c.fill = GridBagConstraints.HORIZONTAL;
	this.add(noteLabel, c);
	
	// buttons
	c.insets.set(10, 10, 10, 10);
	c.anchor = GridBagConstraints.SOUTHEAST;
	c.gridy++;
	c.fill = GridBagConstraints.NONE;
	this.add(keepButtonsRightPanel, c);


	// make visible
	this.pack();
	Session.getSession().getFrames().setLocationRelativeToMainFrame(this);
	this.setVisible(true);
}