Java Code Examples for javax.swing.JPanel.setMaximumSize()

The following are Jave code examples for showing how to use setMaximumSize() of the javax.swing.JPanel class. You can vote up the examples you like. Your votes will be used in our system to get more good examples.
+ Save this method
Example 1
Project: incubator-netbeans   File: ErrorPanel.java   View Source Code Vote up 6 votes
private void btnStackActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnStackActionPerformed
    StringWriter sw = new StringWriter();
    exception.printStackTrace(new PrintWriter(sw));
    JPanel pnl = new JPanel();
    pnl.setLayout(new BorderLayout());
    pnl.setBorder(BorderFactory.createEmptyBorder(6, 6, 6, 6));
    JTextArea ta = new JTextArea();
    ta.setText(sw.toString());
    ta.setEditable(false);
    JScrollPane pane = new JScrollPane(ta);
    pnl.add(pane);
    pnl.setMaximumSize(new Dimension(600, 300));
    pnl.setPreferredSize(new Dimension(600, 300));
    NotifyDescriptor.Message nd = new NotifyDescriptor.Message(pnl);
    DialogDisplayer.getDefault().notify(nd);

}
 
Example 2
Project: jmt   File: MMQueues.java   View Source Code Vote up 6 votes
private JPanel getSplitter(int widht, int height) {
	JPanel splitPane = new JPanel();
	Dimension dim = new Dimension(widht, height);
	splitPane.setEnabled(false);
	splitPane.setPreferredSize(dim);
	splitPane.setMaximumSize(dim);
	splitPane.setMinimumSize(dim);
	return splitPane;
}
 
Example 3
Project: jmeter-bzm-plugins   File: Http2DefaultsGui.java   View Source Code Vote up 6 votes
private void init() { // WARNING: called from ctor so must not be overridden (i.e. must be private or final)
    setLayout(new BorderLayout(0, 5));
    setBorder(makeBorder());

    // URL CONFIG
    http2RequestPanel = new HTTP2RequestPanel(false, true, false);

    // AdvancedPanel (embedded resources, source address and optional tasks)
    JPanel advancedPanel = new VerticalPanel();
    advancedPanel.add(createEmbeddedRsrcPanel());
    advancedPanel.add(createSourceAddrPanel());
    advancedPanel.add(createOptionalTasksPanel());

    JTabbedPane tabbedPane = new JTabbedPane();
    tabbedPane.add(JMeterUtils
            .getResString("web_testing_basic"), http2RequestPanel);
    tabbedPane.add(JMeterUtils
            .getResString("web_testing_advanced"), advancedPanel);

    JPanel emptyPanel = new JPanel();
    emptyPanel.setMaximumSize(new Dimension());

    add(makeTitlePanel(), BorderLayout.NORTH);
    add(tabbedPane, BorderLayout.CENTER);        
    add(emptyPanel, BorderLayout.SOUTH);
}
 
Example 4
Project: jmeter-bzm-plugins   File: HTTP2RequestGui.java   View Source Code Vote up 6 votes
private void init() {
	setLayout(new BorderLayout(0, 5));
    setBorder(makeBorder());
    
    http2RequestPanel = new HTTP2RequestPanel(true,true,true);
    
    // AdvancedPanel (embedded resources, source address and optional tasks)
    JPanel advancedPanel = new VerticalPanel();
    advancedPanel.add(createEmbeddedRsrcPanel());
    advancedPanel.add(createSourceAddrPanel());
    advancedPanel.add(createOptionalTasksPanel());

    JTabbedPane tabbedPane = new JTabbedPane();
    tabbedPane.add(JMeterUtils
            .getResString("web_testing_basic"), http2RequestPanel);
    tabbedPane.add(JMeterUtils
            .getResString("web_testing_advanced"), advancedPanel);

    JPanel emptyPanel = new JPanel();
    emptyPanel.setMaximumSize(new Dimension());

    add(makeTitlePanel(), BorderLayout.NORTH);
    add(tabbedPane, BorderLayout.CENTER);        
    add(emptyPanel, BorderLayout.SOUTH);
}
 
Example 5
Project: incubator-netbeans   File: BasicReplaceResultsPanel.java   View Source Code Vote up 5 votes
private void init() {
    JPanel leftPanel = new JPanel();
    replaceButton = new JButton();
    replaceButton.addActionListener(new ActionListener() {
        @Override
        public void actionPerformed(ActionEvent e) {
            replace();
        }
    });
    updateReplaceButton();
    leftPanel.setLayout(new BoxLayout(leftPanel, BoxLayout.PAGE_AXIS));
    JPanel buttonPanel = new JPanel();
    buttonPanel.setLayout(new FlowLayout(FlowLayout.LEADING, 2, 1));
    buttonPanel.add(replaceButton);
    replaceButton.setMaximumSize(replaceButton.getPreferredSize());
    buttonPanel.setMaximumSize(new Dimension( // #225246
            (int) buttonPanel.getMaximumSize().getWidth(),
            (int) buttonPanel.getPreferredSize().getHeight()));
    leftPanel.add(resultsOutlineSupport.getOutlineView());
    leftPanel.add(buttonPanel);

    this.splitPane = new JSplitPane();
    splitPane.setLeftComponent(leftPanel);
    splitPane.setRightComponent(new ContextView(resultModel,
            getExplorerManager()));
    initSplitDividerLocationHandling();

    getContentPanel().add(splitPane);
    initResultModelListener();
    replaceButton.getAccessibleContext().setAccessibleDescription(
            NbBundle.getMessage(ResultView.class,
            "ACS_TEXT_BUTTON_REPLACE"));                            //NOI18N
}
 
Example 6
Project: incubator-netbeans   File: ScopeOptionsController.java   View Source Code Vote up 5 votes
/**
 * Initialize panel for controls for scope options and add it to the form
 * panel.
 */
private void initScopeOptionsRow(boolean searchAndReplace) {

    JPanel regexpPanel = new CheckBoxWithButtonPanel(
            chkFileNameRegex, btnTestFileNamePattern);
    if (fileNameComponent != null) {
        fileNameComponent.setLayout(
                new FlowLayout(FlowLayout.LEADING, 0, 0));
        fileNameComponent.add(ignoreListOptionPanel);
        fileNameComponent.add(regexpPanel);
        if (!searchAndReplace) {
            component.add(chkArchives);
            component.add(chkGenerated);
        }
    } else {
        JPanel jp = new JPanel();
        if (searchAndReplace) {
            jp.setLayout(new FlowLayout(FlowLayout.LEADING, 0, 0));
            jp.add(ignoreListOptionPanel);
            jp.add(regexpPanel);
            jp.setMaximumSize(jp.getMinimumSize());
        } else {
            FormLayoutHelper flh = new FormLayoutHelper(jp,
                    FormLayoutHelper.DEFAULT_COLUMN,
                    FormLayoutHelper.DEFAULT_COLUMN);
            flh.addRow(chkArchives, chkGenerated);
            flh.addRow(ignoreListOptionPanel,
                    new CheckBoxWithButtonPanel(
                    chkFileNameRegex, btnTestFileNamePattern));
            jp.setMaximumSize(jp.getMinimumSize());
        }
        component.add(jp);
    }
}
 
Example 7
Project: incubator-netbeans   File: ActiveConfigAction.java   View Source Code Vote up 5 votes
@Override
public Component getToolbarPresenter() {
    // Do not return combo box directly; looks bad.
    JPanel toolbarPanel = new JPanel(new GridBagLayout());
    toolbarPanel.setOpaque(false); // don't interrupt JToolBar background
    toolbarPanel.setMaximumSize(new Dimension(150, 80));
    toolbarPanel.setMinimumSize(new Dimension(150, 0));
    toolbarPanel.setPreferredSize(new Dimension(150, 23));
    initConfigListCombo();
    // XXX top inset of 2 looks better w/ small toolbar, but 1 seems to look better for large toolbar (the default):
    toolbarPanel.add(configListCombo, new GridBagConstraints(0, 0, 1, 1, 1.0, 1.0, GridBagConstraints.CENTER, GridBagConstraints.HORIZONTAL, new Insets(1, 6, 1, 5), 0, 0));
    return toolbarPanel;
}
 
Example 8
Project: incubator-netbeans   File: InfoPanel.java   View Source Code Vote up 5 votes
private JPanel createSeparator() {
    JPanel panel = new JPanel();
    panel.setBackground(javax.swing.UIManager.getDefaults().getColor("Separator.foreground"));
    panel.setMaximumSize(new java.awt.Dimension(32767, 1));
    panel.setMinimumSize(new java.awt.Dimension(10, 1));
    panel.setPreferredSize(new java.awt.Dimension(0, 1));
    return panel;
}
 
Example 9
Project: rapidminer   File: OnboardingDialog.java   View Source Code Vote up 5 votes
static JPanel createButtonPanel(boolean right, JButton... buttons) {
    JPanel btPanel = new JPanel(new FlowLayout(right?2:0, 5, 5));
    btPanel.setOpaque(false);
    JButton[] var3 = buttons;
    int var4 = buttons.length;

    for(int var5 = 0; var5 < var4; ++var5) {
        JButton button = var3[var5];
        btPanel.add(button);
    }

    btPanel.setMaximumSize(new Dimension(btPanel.getMaximumSize().width, btPanel.getPreferredSize().height));
    return btPanel;
}
 
Example 10
Project: QN-ACTR-Release   File: MMQueues.java   View Source Code Vote up 5 votes
private JPanel getSplitter(int widht, int height) {
	JPanel splitPane = new JPanel();
	Dimension dim = new Dimension(widht, height);
	splitPane.setEnabled(false);
	splitPane.setPreferredSize(dim);
	splitPane.setMaximumSize(dim);
	splitPane.setMinimumSize(dim);
	return splitPane;
}
 
Example 11
Project: QN-ACTR-Release   File: UniqueStartScreen.java   View Source Code Vote up 5 votes
private void addApplPanel(JPanel container, AbstractAction action, String engDescr, String itaDescr) {
	FlowLayout fl = new FlowLayout(FlowLayout.LEFT, 3, 3);
	JPanel newArea = new JPanel(fl);
	newArea.setMaximumSize(new Dimension(400, 40));
	newArea.setBorder(new EtchedBorder());
	JButton newAppl = new JButton(action);
	newAppl.setText(null);
	newAppl.setPreferredSize(new Dimension(36, 36));
	JLabel newDescr = new JLabel("<html><body>" + itaDescr + "<br>" + engDescr + "</body></html>");
	newArea.add(newAppl);
	newArea.add(newDescr);
	container.add(newArea);
}
 
Example 12
Project: rapidminer   File: ConfigurableDialog.java   View Source Code Vote up 4 votes
/**
 * Initializes the GUI.
 */
private void initGUI() {
	realOuterPanel = new JPanel(new BorderLayout());

	outerLayer = new JLayer<JPanel>(realOuterPanel);
	savingGlassPane = new TransparentGlassPanePanel(WAITING_ICON,
			I18N.getGUILabel("configurable_dialog.saving_configurables"), getBackground(), 0.5f);
	outerLayer.setGlassPane(savingGlassPane);
	savingGlassPane.setVisible(false);

	JPanel pagePanel = new JPanel(new BorderLayout());

	// list of configurables
	JPanel configPanel = createConfigPanel();
	// force size so it does not resize itself depending on entered values
	configPanel.setMinimumSize(CONFIG_LIST_SIZE);
	configPanel.setMaximumSize(CONFIG_LIST_SIZE);
	configPanel.setPreferredSize(CONFIG_LIST_SIZE);
	buttonPanel = createConfigurableButtonPanel();
	// create middle spacer
	JLabel spacer = new JLabel();
	spacer.setMinimumSize(DIMENSION_SPACER_MIDDLE);
	spacer.setMaximumSize(DIMENSION_SPACER_MIDDLE);
	spacer.setPreferredSize(DIMENSION_SPACER_MIDDLE);
	// add both to an outer panel for layout reasons
	JPanel outerConfigPanel = new JPanel(new BorderLayout());
	outerConfigPanel.setBorder(BorderFactory.createMatteBorder(0, 1, 1, 1, Color.LIGHT_GRAY));
	outerConfigPanel.add(configPanel, BorderLayout.CENTER);
	outerConfigPanel.add(buttonPanel, BorderLayout.SOUTH);
	// another panel for layouting
	JPanel outermostConfigPanel = new JPanel(new BorderLayout());
	outermostConfigPanel.add(outerConfigPanel, BorderLayout.CENTER);
	outermostConfigPanel.add(spacer, BorderLayout.EAST);

	// glass pane showed if the user is not able to edit connections due to an old version of
	// the server
	simpleGlassPane = new TransparentGlassPanePanel(null, null, getBackground(), 0.5f);

	// panel displaying the selected configurable
	JPanel paramPanel = createParameterPanel();

	GridBagConstraints c = new GridBagConstraints();
	c.fill = GridBagConstraints.BOTH;
	c.weightx = 1;
	c.weighty = 0.3;
	c.gridwidth = GridBagConstraints.REMAINDER;

	// add panels to page panel
	pagePanel.add(outermostConfigPanel, BorderLayout.WEST);
	pagePanel.add(paramPanel, BorderLayout.CENTER);

	// add page and button panel to outer panel
	realOuterPanel.add(pagePanel, BorderLayout.CENTER);

	layoutDefault(outerLayer, makeSaveButton(), makeCancel());
	setDefaultSize(ButtonDialog.HUGE);
	setLocationRelativeTo(ApplicationFrame.getApplicationFrame());
	setModal(true);
	setDefaultCloseOperation(DO_NOTHING_ON_CLOSE);
	addWindowListener(new WindowAdapter() {

		@Override
		public void windowClosing(WindowEvent e) {
			cancelButton.doClick();
		}
	});

	updateButtonState(true);
}
 
Example 13
Project: tomcat7   File: MapDemo.java   View Source Code Vote up 4 votes
public SimpleTableDemo(LazyReplicatedMap<String,StringBuilder> map) {
    super();
    this.map = map;

    this.setComponentOrientation(ComponentOrientation.LEFT_TO_RIGHT);

    //final JTable table = new JTable(data, columnNames);
    table = new JTable(dataModel);

    table.setPreferredScrollableViewportSize(new Dimension(WIDTH, 150));
    for ( int i=0; i<table.getColumnCount(); i++ ) {
        TableColumn tm = table.getColumnModel().getColumn(i);
        tm.setCellRenderer(new ColorRenderer());
    }


    if (DEBUG) {
        table.addMouseListener(new MouseAdapter() {
            @Override
            public void mouseClicked(MouseEvent e) {
                printDebugData(table);
            }
        });
    }

    //setLayout(new GridLayout(5, 0));
    setLayout(new BoxLayout(this, BoxLayout.Y_AXIS));

    //Create the scroll pane and add the table to it.
    JScrollPane scrollPane = new JScrollPane(table);

    //Add the scroll pane to this panel.
    add(scrollPane);

    //create a add value button
    JPanel addpanel = new JPanel();
    addpanel.setPreferredSize(new Dimension(WIDTH,30));
    addpanel.add(createButton("Add","add"));
    addpanel.add(txtAddKey);
    addpanel.add(txtAddValue);
    addpanel.setMaximumSize(new Dimension(WIDTH,30));
    add(addpanel);

    //create a remove value button
    JPanel removepanel = new JPanel( );
    removepanel.setPreferredSize(new Dimension(WIDTH,30));
    removepanel.add(createButton("Remove","remove"));
    removepanel.add(txtRemoveKey);
    removepanel.setMaximumSize(new Dimension(WIDTH,30));
    add(removepanel);

    //create a change value button
    JPanel changepanel = new JPanel( );
    changepanel.add(createButton("Change","change"));
    changepanel.add(txtChangeKey);
    changepanel.add(txtChangeValue);
    changepanel.setPreferredSize(new Dimension(WIDTH,30));
    changepanel.setMaximumSize(new Dimension(WIDTH,30));
    add(changepanel);


    //create sync button
    JPanel syncpanel = new JPanel( );
    syncpanel.add(createButton("Synchronize","sync"));
    syncpanel.add(createButton("Replicate","replicate"));
    syncpanel.add(createButton("Random","random"));
    syncpanel.setPreferredSize(new Dimension(WIDTH,30));
    syncpanel.setMaximumSize(new Dimension(WIDTH,30));
    add(syncpanel);


}
 
Example 14
Project: Equella   File: FileListPanel.java   View Source Code Vote up 4 votes
public Renderer()
{
	dateFormat = new SimpleDateFormat();

	icon = new IconLabel();

	filename = new JLabel(" ");
	// filename.setVerticalAlignment(SwingConstants.CENTER);

	Font f = filename.getFont();
	filename.setFont(f.deriveFont((float) (f.getSize() + 2)));

	sizeLabel = new JLabel(CurrentLocale.get("cell.size"));
	size = new JLabel();
	modifiedLabel = new JLabel(CurrentLocale.get("cell.modified"));
	modified = new JLabel();

	Dimension modPrefSize = modifiedLabel.getPreferredSize();
	final int width1 = 40;
	final int width2 = Math.max(sizeLabel.getPreferredSize().width, modPrefSize.width) + 5;
	final int height1 = filename.getPreferredSize().height;
	final int height2 = modPrefSize.height;

	MigLayout layout = new MigLayout("", "[" + width1 + "][" + width2 + "][200 - " + (width2 + width1) + "]",
		"[" + height1 + "]2[" + height2 + "]2[" + height2 + "]");

	base = new JPanel(layout);
	base.setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 5));
	base.setBackground(Color.WHITE);

	base.add(icon, "cell 0 0, spany 3");
	base.add(filename, "cell 1 0, spanx 2");
	base.add(sizeLabel, "cell 1 1");
	base.add(size, "cell 2 1");
	base.add(modifiedLabel, "cell 1 2");
	base.add(modified, "cell 2 2");
	int prefHeight = height1 + (height2 * 2) + 24; // size of the 3 rows
													// plus a little
													// padding

	base.setPreferredSize(new Dimension(MAX_CELL_WIDTH, prefHeight));
	base.setMaximumSize(new Dimension(MAX_CELL_WIDTH, prefHeight));
	base.setMinimumSize(new Dimension(MAX_CELL_WIDTH, prefHeight));

	if( CurrentLocale.isRightToLeft() )
	{
		base.applyComponentOrientation(ComponentOrientation.RIGHT_TO_LEFT);

	}
}
 
Example 15
Project: Equella   File: GeneralDialog.java   View Source Code Vote up 4 votes
protected void setupGUI()
{
	inner = new JPanel();
	inner.setLayout(new GridLayout(1, 1));

	okButton = new JButton(CurrentLocale.get("com.dytech.edge.admin.helper.ok"));
	cancelButton = new JButton(CurrentLocale.get("com.dytech.edge.admin.helper.cancel"));

	okButton.addActionListener(this);
	cancelButton.addActionListener(this);

	JLabel heading = new JLabel("<html><b>" + title + "</b>");
	heading.setAlignmentY(Component.BOTTOM_ALIGNMENT);

	JPanel top = new JPanel();
	top.setLayout(new BoxLayout(top, BoxLayout.X_AXIS));
	top.add(Box.createRigidArea(new Dimension(5, 0)));
	top.add(new JLabel(new ImageIcon(GeneralDialog.class.getResource(QUESTION_MARK))));
	top.add(Box.createRigidArea(new Dimension(5, 0)));
	top.add(heading);
	top.add(Box.createHorizontalGlue());

	JPanel bottom = new JPanel();
	bottom.setLayout(new BoxLayout(bottom, BoxLayout.X_AXIS));
	bottom.add(Box.createHorizontalGlue());
	bottom.add(okButton);
	bottom.add(Box.createRigidArea(new Dimension(5, 0)));
	bottom.add(cancelButton);
	bottom.setMaximumSize(bottom.getPreferredSize());

	JPanel middle = new JPanel();
	middle.setLayout(new BoxLayout(middle, BoxLayout.X_AXIS));
	middle.add(Box.createRigidArea(new Dimension(37, 0)));
	middle.add(inner);
	middle.add(Box.createRigidArea(new Dimension(5, 0)));

	content = new JPanel();
	content.setLayout(new BoxLayout(content, BoxLayout.Y_AXIS));
	content.add(Box.createRigidArea(new Dimension(0, 5)));
	content.add(top);
	content.add(Box.createRigidArea(new Dimension(0, 5)));
	content.add(middle);
	content.add(Box.createRigidArea(new Dimension(0, 5)));
	content.add(bottom);
	content.add(Box.createRigidArea(new Dimension(0, 5)));
}
 
Example 16
Project: PointOfSale   File: CheckoutFrame.java   View Source Code Vote up 4 votes
public void addNumpad(Panel panel, JTextField input)
	{
		JPanel numPnl = new JPanel(new GridLayout(4,3));
		JPanel zeroPnl = new JPanel(new BorderLayout());
		
		for(int i = 1; i < 13; i++){
			
			JButton numBtn = new JButton();


			if(i == 10){
				numBtn.setText(String.valueOf("0"));
				numBtn.addActionListener(e -> RetailHelper.addToTextField(input, numBtn.getText()));
			}
			else if (i == 11) {
				numBtn.setText(String.valueOf("."));
				numBtn.addActionListener(e -> RetailHelper.addToTextField(input, numBtn.getText()));
			}
			else if (i == 12) {
				numBtn.setText(String.valueOf("clr"));
				numBtn.addActionListener(e -> RetailHelper.setTextField(input, ""));
			}
			else {
				numBtn.setText(String.valueOf(i));
				numBtn.addActionListener(e -> RetailHelper.addToTextField(input, numBtn.getText()));				
			}
			numPnl.add(numBtn);
				
//				JButton zeroBtn = new JButton();
//				zeroBtn.setText("0");
//				zeroBtn.addActionListener(e -> input.setText(input.getText()+ "" + zeroBtn.getText()));
//				zeroPnl.add(zeroBtn, BorderLayout.CENTER);
//				barcodePnl.add(b, BorderLayout.SOUTH);
//			}
		}
		JPanel eastNumPnl = new JPanel();
		eastNumPnl.setLayout(new BoxLayout(eastNumPnl, BoxLayout.PAGE_AXIS));

		Dimension size = new Dimension(100, 100);
		zeroPnl.setPreferredSize(size);
		zeroPnl.setSize(size);
		zeroPnl.setMaximumSize(size);

		
		panel.add(numPnl, BorderLayout.SOUTH);
		//panel.add(zeroPnl, BorderLayout.SOUTH);
	}
 
Example 17
Project: apache-tomcat-7.0.73-with-comment   File: MapDemo.java   View Source Code Vote up 4 votes
public SimpleTableDemo(LazyReplicatedMap<String,StringBuilder> map) {
    super();
    this.map = map;

    this.setComponentOrientation(ComponentOrientation.LEFT_TO_RIGHT);

    //final JTable table = new JTable(data, columnNames);
    table = new JTable(dataModel);

    table.setPreferredScrollableViewportSize(new Dimension(WIDTH, 150));
    for ( int i=0; i<table.getColumnCount(); i++ ) {
        TableColumn tm = table.getColumnModel().getColumn(i);
        tm.setCellRenderer(new ColorRenderer());
    }


    if (DEBUG) {
        table.addMouseListener(new MouseAdapter() {
            @Override
            public void mouseClicked(MouseEvent e) {
                printDebugData(table);
            }
        });
    }

    //setLayout(new GridLayout(5, 0));
    setLayout(new BoxLayout(this, BoxLayout.Y_AXIS));

    //Create the scroll pane and add the table to it.
    JScrollPane scrollPane = new JScrollPane(table);

    //Add the scroll pane to this panel.
    add(scrollPane);

    //create a add value button
    JPanel addpanel = new JPanel();
    addpanel.setPreferredSize(new Dimension(WIDTH,30));
    addpanel.add(createButton("Add","add"));
    addpanel.add(txtAddKey);
    addpanel.add(txtAddValue);
    addpanel.setMaximumSize(new Dimension(WIDTH,30));
    add(addpanel);

    //create a remove value button
    JPanel removepanel = new JPanel( );
    removepanel.setPreferredSize(new Dimension(WIDTH,30));
    removepanel.add(createButton("Remove","remove"));
    removepanel.add(txtRemoveKey);
    removepanel.setMaximumSize(new Dimension(WIDTH,30));
    add(removepanel);

    //create a change value button
    JPanel changepanel = new JPanel( );
    changepanel.add(createButton("Change","change"));
    changepanel.add(txtChangeKey);
    changepanel.add(txtChangeValue);
    changepanel.setPreferredSize(new Dimension(WIDTH,30));
    changepanel.setMaximumSize(new Dimension(WIDTH,30));
    add(changepanel);


    //create sync button
    JPanel syncpanel = new JPanel( );
    syncpanel.add(createButton("Synchronize","sync"));
    syncpanel.add(createButton("Replicate","replicate"));
    syncpanel.add(createButton("Random","random"));
    syncpanel.setPreferredSize(new Dimension(WIDTH,30));
    syncpanel.setMaximumSize(new Dimension(WIDTH,30));
    add(syncpanel);


}
 
Example 18
Project: xdman   File: XDMMainWindow.java   View Source Code Vote up 4 votes
private void createTabs() {
	JButton btnAllTab = new XDMButton(getString("ALL_DOWNLOADS")),
			btnIncompleteTab = new XDMButton(getString("ALL_UNFINISHED")),
			btnCompletedTab = new XDMButton(getString("ALL_FINISHED"));

	btnTabArr = new JButton[3];
	btnTabArr[0] = btnAllTab;
	btnTabArr[0].setName("ALL_DOWNLOADS");
	btnTabArr[1] = btnIncompleteTab;
	btnTabArr[1].setName("ALL_UNFINISHED");
	btnTabArr[2] = btnCompletedTab;
	btnTabArr[2].setName("ALL_FINISHED");

	for (int i = 0; i < 3; i++) {
		btnTabArr[i].setFont(StaticResource.plainFontBig);
		btnTabArr[i].setBorderPainted(false);
		btnTabArr[i].addActionListener(this);
	}

	btnAllTab.setBackground(new Color(242, 242, 242));

	btnIncompleteTab.setBackground(StaticResource.titleColor);
	btnIncompleteTab.setForeground(StaticResource.whiteColor);

	btnCompletedTab.setBackground(StaticResource.titleColor);
	btnCompletedTab.setForeground(StaticResource.whiteColor);

	JPanel pp = new JPanel(new BorderLayout());
	pp.setOpaque(false);

	JPanel p = new JPanel(new GridLayout(1, 3, 5, 0));
	p.setOpaque(false);
	Dimension d = new Dimension(350, 30);
	p.setPreferredSize(d);
	p.setMaximumSize(d);
	p.setMinimumSize(d);
	p.setBackground(Color.WHITE);
	p.add(btnAllTab);
	p.add(btnIncompleteTab);
	p.add(btnCompletedTab);
	pp.add(p, BorderLayout.EAST);

	getTitlePanel().add(pp, BorderLayout.SOUTH);
}