Java Code Examples for javax.swing.JToolBar#setMargin()

The following examples show how to use javax.swing.JToolBar#setMargin() . 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: GUIFrame.java    From jaamsim with Apache License 2.0 4 votes vote down vote up
/**
 * Sets up the Control Panel's main tool bar.
 */
public void initializeMainToolBars() {

	// Insets used in setting the tool bar components
	Insets noMargin = new Insets( 0, 0, 0, 0 );
	Insets smallMargin = new Insets( 1, 1, 1, 1 );

	// Initialize the main tool bar
	JToolBar mainToolBar = new JToolBar();
	mainToolBar.setMargin( smallMargin );
	mainToolBar.setFloatable(false);
	mainToolBar.setLayout( new FlowLayout( FlowLayout.LEFT, 0, 0 ) );

	// Add the main tool bar to the display
	getContentPane().add( mainToolBar, BorderLayout.SOUTH );

	// Run/pause button
	addRunButton(mainToolBar, noMargin);

	Dimension separatorDim = new Dimension(11, controlStartResume.getPreferredSize().height);
	Dimension gapDim = new Dimension(5, separatorDim.height);

	// Reset button
	mainToolBar.add(Box.createRigidArea(gapDim));
	addResetButton(mainToolBar, noMargin);

	// Real time button
	mainToolBar.addSeparator(separatorDim);
	addRealTimeButton(mainToolBar, smallMargin);

	// Speed multiplier spinner
	mainToolBar.add(Box.createRigidArea(gapDim));
	addSpeedMultiplier(mainToolBar, noMargin);

	// Pause time field
	mainToolBar.addSeparator(separatorDim);
	mainToolBar.add(new JLabel("Pause Time:"));
	mainToolBar.add(Box.createRigidArea(gapDim));
	addPauseTime(mainToolBar, noMargin);

	// Simulation time display
	mainToolBar.addSeparator(separatorDim);
	addSimulationTime(mainToolBar, noMargin);

	// Run progress bar
	mainToolBar.add(Box.createRigidArea(gapDim));
	addRunProgress(mainToolBar, noMargin);

	// Remaining time display
	mainToolBar.add(Box.createRigidArea(gapDim));
	addRemainingTime(mainToolBar, noMargin);

	// Achieved speed multiplier
	mainToolBar.addSeparator(separatorDim);
	mainToolBar.add(new JLabel("Speed:"));
	addAchievedSpeedMultiplier(mainToolBar, noMargin);

	// Cursor position
	mainToolBar.addSeparator(separatorDim);
	mainToolBar.add(new JLabel("Position:"));
	addCursorPosition(mainToolBar, noMargin);
}
 
Example 2
Source File: JComponentBuilders.java    From netbeans with Apache License 2.0 3 votes vote down vote up
protected void setupInstance(JToolBar instance) {
    super.setupInstance(instance);
    
    instance.setBorderPainted(paintBorder);
    
    if (margin != null) instance.setMargin(margin.createInstance());
    
    instance.setFloatable(floatable);
    instance.setOrientation(orientation);
}
 
Example 3
Source File: JComponentBuilders.java    From visualvm with GNU General Public License v2.0 3 votes vote down vote up
protected void setupInstance(JToolBar instance) {
    super.setupInstance(instance);
    
    instance.setBorderPainted(paintBorder);
    
    if (margin != null) instance.setMargin(margin.createInstance());
    
    instance.setFloatable(floatable);
    instance.setOrientation(orientation);
}