Java Code Examples for java.awt.GridBagConstraints#SOUTHWEST

The following examples show how to use java.awt.GridBagConstraints#SOUTHWEST . 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: BeanShellPanel.java    From zap-extensions with Apache License 2.0 6 votes vote down vote up
/** This method initializes this */
private void initialize() {
    GridBagConstraints gridBagConstraints4 = new GridBagConstraints();
    GridBagConstraints gridBagConstraints1 = new GridBagConstraints();

    this.setLayout(new GridBagLayout());
    this.setPreferredSize(new Dimension(400, 300));
    gridBagConstraints1.gridx = 0;
    gridBagConstraints1.gridy = 0;
    gridBagConstraints1.weightx = 1.0;
    gridBagConstraints1.weighty = 1.0;
    gridBagConstraints1.fill = GridBagConstraints.BOTH;
    gridBagConstraints1.ipadx = 0;
    gridBagConstraints1.ipady = 0;
    gridBagConstraints4.anchor = GridBagConstraints.SOUTHWEST;
    gridBagConstraints4.fill = GridBagConstraints.HORIZONTAL;
    gridBagConstraints4.gridx = 0;
    gridBagConstraints4.gridy = 1;
    gridBagConstraints4.weightx = 1.0D;
    this.add(getSplitVert(), gridBagConstraints1);
    this.add(getJPanel(), gridBagConstraints4);
}
 
Example 2
Source File: FieldPatternPanel.java    From nextreports-designer with Apache License 2.0 6 votes vote down vote up
private JPanel createSamplePanel() {
    JPanel samplePanel = new JPanel();
    samplePanel.setLayout(new GridBagLayout());

    GridBagConstraints gridBagConstraints = new GridBagConstraints();
    gridBagConstraints.anchor = GridBagConstraints.WEST;
    JLabel tmpLabel = new JLabel(I18NSupport.getString("pattern.sample"));
    tmpLabel.setFont(new Font("SansSerif", 0, 11));
    samplePanel.add(tmpLabel, gridBagConstraints);

    sampleLabel = new JLabel();
    sampleLabel.setBorder(new LineBorder(Color.BLACK, 1));
    sampleLabel.setBackground(Color.WHITE);
    sampleLabel.setOpaque(true);
    sampleLabel.setFont(new Font("SansSerif", 0, 12));
    sampleLabel.setHorizontalAlignment(SwingConstants.CENTER);
    
    gridBagConstraints.gridy = 1;
    gridBagConstraints.fill = GridBagConstraints.BOTH;
    gridBagConstraints.anchor = GridBagConstraints.SOUTHWEST;
    gridBagConstraints.weightx = 1.0;
    gridBagConstraints.weighty = 1.0;
    samplePanel.add(sampleLabel, gridBagConstraints);
    
    return samplePanel;
}
 
Example 3
Source File: DesktopImpl.java    From netbeans with Apache License 2.0 5 votes vote down vote up
public void addSlidingView (SlidingView view) {
    Set<SlidingView> slidingViews = getSlidingViews();
    if (slidingViews.contains(view)) {
        return;
    }
    slidingViews.add(view);
    GridBagConstraints constraint = new GridBagConstraints();
    constraint.fill = GridBagConstraints.BOTH;
    if (Constants.BOTTOM.equals(view.getSide())) {
        constraint.gridx = 0;
        constraint.gridy = 2;
        constraint.gridwidth = 3;
        constraint.anchor = GridBagConstraints.SOUTHWEST;
        
    } else if (Constants.LEFT.equals(view.getSide())) {
        constraint.gridx = 0;
        constraint.gridy = 1;
        constraint.gridheight = 1;
        constraint.anchor = GridBagConstraints.NORTHWEST;
    } else if (Constants.RIGHT.equals(view.getSide())) {
        constraint.gridx = 2;
        constraint.gridy = 1;
        constraint.gridheight = 1;
        constraint.anchor = GridBagConstraints.NORTHEAST;
    } else if (Constants.TOP.equals(view.getSide())) {
        constraint.gridx = 1;
        constraint.gridy = 0;
        constraint.gridheight = 1;
        constraint.gridwidth = 2;
        constraint.anchor = GridBagConstraints.NORTHWEST;
    }
    desktop.add(view.getComponent(), constraint);
    if( Constants.BOTTOM.equals( view.getSide()) && view.getComponent() instanceof JPanel ) {
        JPanel panel = ( JPanel ) view.getComponent();
        MainWindow.getInstance().setStatusBarContainer( panel );
    }
    // #45033 fix - invalidate isn't enough, revalidate is correct
    layeredPane.revalidate();
}
 
Example 4
Source File: AbstractConnectionGUI.java    From rapidminer-studio with GNU Affero General Public License v3.0 5 votes vote down vote up
/**
 * Adds a tab that contains the given component as well as the injection button on the bottom
 *
 * @param group
 * 		the group that is used for i18n and {@link #getInjectableParameters(ConnectionParameterGroupModel)}
 * @param component
 * 		the content of the tab without the inject functionality
 */
protected void addInjectableTab(ConnectionParameterGroupModel group, JComponent component) {
	JPanel panelAndInject = new JPanel(new GridBagLayout());
	GridBagConstraints c = new GridBagConstraints();
	if (component == null) {
		return;
	}

	c.anchor = GridBagConstraints.WEST;
	c.weighty = 1;
	c.weightx = 1;
	c.fill = GridBagConstraints.BOTH;
	c.gridx = 0;
	c.anchor = GridBagConstraints.NORTHWEST;
	panelAndInject.add(component, c);

	if (getConnectionModel().isEditable()) {
		c.weighty = 0;
		panelAndInject.add(new JSeparator(JSeparator.HORIZONTAL), c);

		c.anchor = GridBagConstraints.SOUTHWEST;
		panelAndInject.add(getInjectionPanel(() -> getInjectableParameters(group)), c);
	}

	String typeKey = getConnectionModel().getType();
	String groupKey = group.getName();
	String title = ConnectionI18N.getGroupName(typeKey, groupKey, ConnectionI18N.LABEL_SUFFIX, groupKey);
	String tip = ConnectionI18N.getGroupName(typeKey, groupKey, ConnectionI18N.TIP_SUFFIX, null);
	Icon icon = ConnectionI18N.getGroupIcon(typeKey, groupKey);

	getTabbedPane().addTab(title, icon, panelAndInject, tip);
}
 
Example 5
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 6
Source File: JWTViewTab.java    From JWT4B with GNU General Public License v3.0 4 votes vote down vote up
private void drawPanel() {
	GridBagLayout gridBagLayout = new GridBagLayout();
	gridBagLayout.columnWidths = new int[] { 10, 447, 0, 0 };
	gridBagLayout.rowHeights = new int[] { 10, 10, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 };
	gridBagLayout.columnWeights = new double[] { 0.0, 1.0, 0.0, Double.MIN_VALUE };
	gridBagLayout.rowWeights = new double[] { 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, Double.MIN_VALUE };
	setLayout(gridBagLayout);
	
	keyLabel = new JLabel(" ");
	keyLabel.setFont(new Font("Tahoma", Font.BOLD, 12));
	GridBagConstraints gbc_inputLabel1 = new GridBagConstraints();
	gbc_inputLabel1.fill = GridBagConstraints.VERTICAL;
	gbc_inputLabel1.insets = new Insets(0, 0, 5, 5);
	gbc_inputLabel1.anchor = GridBagConstraints.WEST;
	gbc_inputLabel1.gridx = 1;
	gbc_inputLabel1.gridy = 1;
	add(keyLabel, gbc_inputLabel1);

	jwtKeyArea = new JTextArea();
	GridBagConstraints gbc_inputField1 = new GridBagConstraints();
	gbc_inputField1.insets = new Insets(0, 0, 5, 5);
	gbc_inputField1.fill = GridBagConstraints.HORIZONTAL;
	gbc_inputField1.gridx = 1;
	gbc_inputField1.gridy = 2;
	add(jwtKeyArea, gbc_inputField1);
	jwtKeyArea.setColumns(10);
	
	verificationIndicator = new JButton("");
	Dimension preferredSize = new Dimension(400, 30);
	verificationIndicator.setPreferredSize(preferredSize);
	GridBagConstraints gbc_validIndicator = new GridBagConstraints();
	gbc_validIndicator.insets = new Insets(0, 0, 5, 5);
	gbc_validIndicator.gridx = 1;
	gbc_validIndicator.gridy = 4;
	add(verificationIndicator, gbc_validIndicator);

	outputField = new RSyntaxTextArea();
	SyntaxScheme scheme = outputField.getSyntaxScheme();
	Style style = new Style();
	style.foreground = new Color(222,133,10);
	scheme.setStyle(Token.LITERAL_STRING_DOUBLE_QUOTE, style);
	outputField.revalidate();
	outputField.setHighlightCurrentLine(false);
	outputField.setCurrentLineHighlightColor(Color.WHITE);
	outputField.setSyntaxEditingStyle(SyntaxConstants.SYNTAX_STYLE_JAVASCRIPT);
	outputField.setEditable(false);
	outputField.setPopupMenu(new JPopupMenu()); // no context menu on right-click
	
	outputLabel = new JLabel("JWT");
	outputLabel.setFont(new Font("Tahoma", Font.BOLD, 12));
	GridBagConstraints gbc_outputLabel = new GridBagConstraints();
	gbc_outputLabel.anchor = GridBagConstraints.WEST;
	gbc_outputLabel.insets = new Insets(0, 0, 5, 5);
	gbc_outputLabel.gridx = 1;
	gbc_outputLabel.gridy = 5;
	add(outputLabel, gbc_outputLabel);
	
	lbRegisteredClaims = new JLabel();
	lbRegisteredClaims.setBackground(SystemColor.controlHighlight);
	GridBagConstraints gbc_lbRegisteredClaims = new GridBagConstraints();
	gbc_lbRegisteredClaims.fill = GridBagConstraints.BOTH;
	gbc_lbRegisteredClaims.insets = new Insets(0, 0, 5, 5);
	gbc_lbRegisteredClaims.gridx = 1;
	gbc_lbRegisteredClaims.gridy = 8;
	add(lbRegisteredClaims, gbc_lbRegisteredClaims);
	
	lblCookieFlags = new JLabel(" ");
	lblCookieFlags.setFont(new Font("Tahoma", Font.BOLD, 12));
	GridBagConstraints gbc_lblCookieFlags = new GridBagConstraints();
	gbc_lblCookieFlags.anchor = GridBagConstraints.SOUTHWEST;
	gbc_lblCookieFlags.insets = new Insets(0, 0, 5, 5);
	gbc_lblCookieFlags.gridx = 1;
	gbc_lblCookieFlags.gridy = 9;
	add(lblCookieFlags, gbc_lblCookieFlags);
	
	RTextScrollPane sp = new RTextScrollPane(outputField);
	sp.setLineNumbersEnabled(false);
	
	GridBagConstraints gbc_outputfield = new GridBagConstraints();
	gbc_outputfield.insets = new Insets(0, 0, 5, 5);
	gbc_outputfield.fill = GridBagConstraints.BOTH;
	gbc_outputfield.gridx = 1;
	gbc_outputfield.gridy = 6;
	add(sp, gbc_outputfield);
}
 
Example 7
Source File: CommonConnUI.java    From mqtt-jmeter with Apache License 2.0 4 votes vote down vote up
public JPanel createProtocolPanel() {
		JPanel protocolPanel = new VerticalPanel();
		protocolPanel.setBorder(BorderFactory.createTitledBorder(BorderFactory.createEtchedBorder(), "Protocols"));
		
		JPanel pPanel = new JPanel();
		pPanel.setLayout(new BorderLayout());
		//pPanel.setLayout(new GridLayout(1, 2));

		JPanel pCenter = new JPanel(new FlowLayout(FlowLayout.LEFT));
//		clientNames = new JLabeledChoice("Clients:", clientNamesList.toArray(new String[] {}), true, false);
//		clientNames.addChangeListener(this);
//		pCenter.add(clientNames);

		protocols = new JLabeledChoice("Protocols:", false);
		//JComboBox<String> component = (JComboBox) protocols.getComponentList().get(1);
		//component.setSize(new Dimension(40, component.getHeight()));
		protocols.addChangeListener(this);
		pCenter.add(protocols);

		wsPath.setFont(null);
		wsPath.setVisible(false);
		pCenter.add(wsPath);

		pPanel.add(pCenter, BorderLayout.CENTER);

		dualAuth.setSelected(false);
		dualAuth.setFont(null);
		dualAuth.setVisible(false);
		dualAuth.addChangeListener(this);
		pPanel.add(dualAuth, BorderLayout.SOUTH);

		JPanel panel = new JPanel(new GridBagLayout());
		GridBagConstraints c = new GridBagConstraints();
		c.anchor = GridBagConstraints.SOUTHWEST;
		
//		c.gridx = 0; c.gridy = 0; c.gridwidth = 2;
//		tksFilePath.setVisible(false);
//		panel.add(tksFilePath, c);
//
//		c.gridx = 2; c.gridy = 0; c.gridwidth = 1;
//		tksBrowseButton = new JButton(JMeterUtils.getResString("browse"));
//		tksBrowseButton.setActionCommand(TKS_BROWSE);
//		tksBrowseButton.addActionListener(this);
//		tksBrowseButton.setVisible(false);
//		panel.add(tksBrowseButton, c);
//		
//		c.gridx = 3; c.gridy = 0; c.gridwidth = 2;
//		tksPassword.setVisible(false);
//		panel.add(tksPassword, c);

		//c.weightx = 0.0;
		c.gridx = 0; c.gridy = 1; c.gridwidth = 2;
		ccFilePath.setVisible(false);
		panel.add(ccFilePath, c);

		c.gridx = 2; c.gridy = 1; c.gridwidth = 1;
		ccBrowseButton = new JButton(JMeterUtils.getResString("browse"));
		ccBrowseButton.setActionCommand(CC_BROWSE);
		ccBrowseButton.addActionListener(this);
		ccBrowseButton.setVisible(false);
		panel.add(ccBrowseButton, c);
		
		c.gridx = 3; c.gridy = 1; c.gridwidth = 2;
		ccPassword.setVisible(false);
		panel.add(ccPassword, c);
		
		protocolPanel.add(pPanel);
		protocolPanel.add(panel);
		
		return protocolPanel;
	}
 
Example 8
Source File: TableDemo.java    From littleluck with Apache License 2.0 4 votes vote down vote up
protected JPanel createControlPanel() {
    JPanel controlPanel = new JPanel();
    GridBagLayout gridbag = new GridBagLayout();
    GridBagConstraints c = new GridBagConstraints();
    controlPanel.setLayout(gridbag);

    c.gridx = 0;
    c.gridy = 1;
    c.gridheight = 1;
    c.insets = new Insets(20, 10, 0, 10);
    c.anchor = GridBagConstraints.SOUTHWEST;
    JLabel searchLabel = new JLabel(getString("TableDemo.searchLabel",
            "Search Titles and Recipients"));
    controlPanel.add(searchLabel, c);

    c.gridx = 0;
    c.gridy = 2;
    c.weightx = 1.0;
    c.insets.top = 0;
    c.insets.bottom = 12;
    c.anchor = GridBagConstraints.SOUTHWEST;
    //c.fill = GridBagConstraints.HORIZONTAL;
    filterField = new JTextField(24);
    filterField.getDocument().addDocumentListener(new SearchFilterListener());
    controlPanel.add(filterField, c);

    c.gridx = 1;
    c.gridy = 2;
    c.gridwidth = GridBagConstraints.REMAINDER;
    //c.insets.right = 24;
    //c.insets.left = 12;
    c.weightx = 0.0;
    c.anchor = GridBagConstraints.EAST;
    c.fill = GridBagConstraints.NONE;
    winnersCheckbox = new JCheckBox(getString("TableDemo.winnersLabel",
            "Show Only Winners"));
    winnersCheckbox.addChangeListener(new ShowWinnersListener());
    controlPanel.add(winnersCheckbox, c);

    return controlPanel;
}
 
Example 9
Source File: TableDemo.java    From beautyeye with Apache License 2.0 4 votes vote down vote up
protected JPanel createControlPanel() {
	JPanel controlPanel = new JPanel();
	GridBagLayout gridbag = new GridBagLayout();
	GridBagConstraints c = new GridBagConstraints();
	controlPanel.setLayout(gridbag);

	c.gridx = 0;
	c.gridy = 1;
	c.gridheight = 1;
	c.insets = new Insets(20, 10, 0, 10);
	c.anchor = GridBagConstraints.SOUTHWEST;
	JLabel searchLabel = new JLabel(getString("TableDemo.searchLabel",
			"Search Titles and Recipients"));
	controlPanel.add(searchLabel, c);

	c.gridx = 0;
	c.gridy = 2;
	c.weightx = 1.0;
	c.insets.top = 0;
	c.insets.bottom = 12;
	c.anchor = GridBagConstraints.SOUTHWEST;
	// c.fill = GridBagConstraints.HORIZONTAL;
	filterField = new JTextField(24);
	filterField.getDocument().addDocumentListener(
			new SearchFilterListener());
	controlPanel.add(filterField, c);

	c.gridx = 1;
	c.gridy = 2;
	c.gridwidth = GridBagConstraints.REMAINDER;
	// c.insets.right = 24;
	// c.insets.left = 12;
	c.weightx = 0.0;
	c.anchor = GridBagConstraints.EAST;
	c.fill = GridBagConstraints.NONE;
	winnersCheckbox = new JCheckBox(getString("TableDemo.winnersLabel",
			"Show Only Winners"));
	winnersCheckbox.addChangeListener(new ShowWinnersListener());
	controlPanel.add(winnersCheckbox, c);

	return controlPanel;
}
 
Example 10
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;
    }
}