Java Code Examples for java.awt.BorderLayout#SOUTH

The following examples show how to use java.awt.BorderLayout#SOUTH . 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: CustomAxisEditionDialog.java    From Girinoscope with Apache License 2.0 6 votes vote down vote up
private CustomAxisEditionDialog(JFrame owner, Axis.Builder axisBuilder) {
    super(owner, true);
    this.axisBuilder = axisBuilder;

    super.setTitle("Y Axis parameters");
    super.setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE);

    super.addWindowListener(new WindowAdapter() {
        @Override
        public void windowClosing(WindowEvent e) {
            CustomAxisEditionDialog.this.axisBuilder = null;
        }
    });

    super.setLayout(new BorderLayout());
    super.setBackground(Color.WHITE);
    super.add(createEditorPane(), BorderLayout.CENTER);
    super.add(createButtonBar(cancelAction, applyAction), BorderLayout.SOUTH);

    super.pack();
    super.setLocationRelativeTo(owner);
    super.setResizable(false);

    DialogHelper.installEscapeCloseOperation(CustomAxisEditionDialog.this);
}
 
Example 2
Source File: ConstantParser.java    From osp with GNU General Public License v3.0 6 votes vote down vote up
static public Value constraintsConstant(String _value) {
  _value = _value.trim().toLowerCase();
  if(_value.equals("north")) { //$NON-NLS-1$
    return new StringValue(BorderLayout.NORTH);
  }
  if(_value.equals("south")) { //$NON-NLS-1$
    return new StringValue(BorderLayout.SOUTH);
  }
  if(_value.equals("east")) { //$NON-NLS-1$
    return new StringValue(BorderLayout.EAST);
  }
  if(_value.equals("west")) { //$NON-NLS-1$
    return new StringValue(BorderLayout.WEST);
  }
  if(_value.equals("center")) { //$NON-NLS-1$
    return new StringValue(BorderLayout.CENTER);
  }
  return new StringValue(BorderLayout.CENTER);
}
 
Example 3
Source File: Frame.java    From Logisim with GNU General Public License v3.0 5 votes vote down vote up
private void placeToolbar() {
	String loc = AppPreferences.TOOLBAR_PLACEMENT.get();
	Container contents = getContentPane();
	contents.remove(toolbar);
	mainPanelSuper.remove(toolbar);
	if (AppPreferences.TOOLBAR_HIDDEN.equals(loc)) {
		; // don't place value anywhere
	} else if (AppPreferences.TOOLBAR_DOWN_MIDDLE.equals(loc)) {
		toolbar.setOrientation(Toolbar.VERTICAL);
		mainPanelSuper.add(toolbar, BorderLayout.WEST);
	} else { // it is a BorderLayout constant
		Object value = BorderLayout.NORTH;
		for (Direction dir : Direction.cardinals) {
			if (dir.toString().equals(loc)) {
				if (dir == Direction.EAST)
					value = BorderLayout.EAST;
				else if (dir == Direction.SOUTH)
					value = BorderLayout.SOUTH;
				else if (dir == Direction.WEST)
					value = BorderLayout.WEST;
				else
					value = BorderLayout.NORTH;
			}
		}
		contents.add(toolbar, value);
		boolean vertical = value == BorderLayout.WEST || value == BorderLayout.EAST;
		toolbar.setOrientation(vertical ? Toolbar.VERTICAL : Toolbar.HORIZONTAL);
	}
	contents.validate();
}
 
Example 4
Source File: JWindowToolBarUI.java    From pdfxtk with Apache License 2.0 5 votes vote down vote up
private String getDockingConstraint(Component c, Point p) {
  String result = BorderLayout.NORTH;
  boolean trBL = p.y * c.getWidth() < p.x * c.getHeight();
  boolean tlBR = p.y  < c.getHeight() + (p.x * -(c.getHeight()) / c.getWidth());
  if(trBL && tlBR)
    result = BorderLayout.NORTH;
  if(trBL && !tlBR)
    result = BorderLayout.EAST;
  if(!trBL && tlBR)
    result = BorderLayout.WEST;
  if(!trBL && !tlBR)
    result = BorderLayout.SOUTH;
  // System.out.println(result);
  return result;
}
 
Example 5
Source File: DialogSupport.java    From netbeans with Apache License 2.0 4 votes vote down vote up
public Dialog createDialog( String title, JPanel panel, boolean modal,
        JButton[] buttons, boolean sidebuttons, int defaultIndex,
        int cancelIndex, ActionListener listener ) {

    // create the dialog with given content
    JDialog d = new JDialog( (javax.swing.JFrame)null, title, modal );
    d.setDefaultCloseOperation( WindowConstants.DO_NOTHING_ON_CLOSE );
    d.getContentPane().add( panel, BorderLayout.CENTER);
    
    // Add the buttons to it
    JPanel buttonPanel = createButtonPanel( buttons, sidebuttons );
    String buttonAlign = sidebuttons ? BorderLayout.EAST : BorderLayout.SOUTH;
    d.getContentPane().add( buttonPanel, buttonAlign );

    // add listener to buttons
    if( listener != null ) {
        for( int i = 0; i < buttons.length; i++ ) {
            buttons[i].addActionListener( listener );
        }
    }

    // register the default button, if available
    if( defaultIndex >= 0 ) {
        d.getRootPane().setDefaultButton( buttons[defaultIndex] );
    }
    
    // register the cancel button helpers, if available
    if( cancelIndex >= 0 ) {
        cancelButton = buttons[cancelIndex];
        // redirect the Esc key to Cancel button
        d.getRootPane().registerKeyboardAction(
            this,
            KeyStroke.getKeyStroke(KeyEvent.VK_ESCAPE, 0, true),
            JComponent.WHEN_IN_FOCUSED_WINDOW
        );

        // listen on windowClosing and redirect it to Cancel button
        d.addWindowListener( this );
    }

    d.pack();
    return d;
}
 
Example 6
Source File: ReportAttributesView.java    From ramus with GNU General Public License v3.0 4 votes vote down vote up
@Override
public String getDefaultPosition() {
    return BorderLayout.SOUTH;
}
 
Example 7
Source File: ToolBarSouthState.java    From seaglass with Apache License 2.0 4 votes vote down vote up
/**
 * {@inheritDoc}
 */
public boolean isInState(JComponent c) {
    JToolBar toolbar = (JToolBar) c;

    return SeaGlassLookAndFeel.resolveToolbarConstraint(toolbar) == BorderLayout.SOUTH;
}
 
Example 8
Source File: UI.java    From Girinoscope with Apache License 2.0 4 votes vote down vote up
public UI() {
    super.setTitle("Girinoscope");

    List<Image> icons = new LinkedList<>();
    for (int i = 256; i >= 16; i /= 2) {
        icons.add(Icon.getImage("icon-" + i + ".png"));
    }
    super.setIconImages(icons);

    super.setLayout(new BorderLayout());

    graphPane = new GraphPane();
    graphPane.setYCoordinateSystem(yAxisBuilder.build());
    graphPane.setPreferredSize(new Dimension(800, 600));
    super.add(graphPane, BorderLayout.CENTER);

    super.setJMenuBar(createMenuBar());

    super.add(createToolBar(), BorderLayout.NORTH);

    statusBar = new StatusBar();
    super.add(statusBar, BorderLayout.SOUTH);

    stopAcquiringAction.setEnabled(false);
    exportLastFrameAction.setEnabled(false);

    if (port != null) {
        startAcquiringAction.setEnabled(true);
        startAcquiringInLoopAction.setEnabled(true);
    } else {
        startAcquiringAction.setEnabled(false);
        startAcquiringInLoopAction.setEnabled(false);
        setStatus("red", "No USB to serial adaptation port detected.");
    }

    super.addWindowListener(new WindowAdapter() {
        @Override
        public void windowClosed(WindowEvent e) {
            settings.save();
        }
    });
}