当前位置: 首页>>代码示例>>Java>>正文


Java JPanel.setMaximumSize方法代码示例

本文整理汇总了Java中javax.swing.JPanel.setMaximumSize方法的典型用法代码示例。如果您正苦于以下问题:Java JPanel.setMaximumSize方法的具体用法?Java JPanel.setMaximumSize怎么用?Java JPanel.setMaximumSize使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在javax.swing.JPanel的用法示例。


在下文中一共展示了JPanel.setMaximumSize方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: btnStackActionPerformed

import javax.swing.JPanel; //导入方法依赖的package包/类
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);

}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:18,代码来源:ErrorPanel.java

示例2: getSplitter

import javax.swing.JPanel; //导入方法依赖的package包/类
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;
}
 
开发者ID:max6cn,项目名称:jmt,代码行数:10,代码来源:MMQueues.java

示例3: init

import javax.swing.JPanel; //导入方法依赖的package包/类
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);
}
 
开发者ID:Blazemeter,项目名称:jmeter-bzm-plugins,代码行数:27,代码来源:Http2DefaultsGui.java

示例4: init

import javax.swing.JPanel; //导入方法依赖的package包/类
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);
}
 
开发者ID:Blazemeter,项目名称:jmeter-bzm-plugins,代码行数:26,代码来源:HTTP2RequestGui.java

示例5: init

import javax.swing.JPanel; //导入方法依赖的package包/类
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
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:34,代码来源:BasicReplaceResultsPanel.java

示例6: initScopeOptionsRow

import javax.swing.JPanel; //导入方法依赖的package包/类
/**
 * 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);
    }
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:38,代码来源:ScopeOptionsController.java

示例7: getToolbarPresenter

import javax.swing.JPanel; //导入方法依赖的package包/类
@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;
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:14,代码来源:ActiveConfigAction.java

示例8: createSeparator

import javax.swing.JPanel; //导入方法依赖的package包/类
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;
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:9,代码来源:InfoPanel.java

示例9: createButtonPanel

import javax.swing.JPanel; //导入方法依赖的package包/类
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;
}
 
开发者ID:transwarpio,项目名称:rapidminer,代码行数:15,代码来源:OnboardingDialog.java

示例10: addApplPanel

import javax.swing.JPanel; //导入方法依赖的package包/类
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);
}
 
开发者ID:HOMlab,项目名称:QN-ACTR-Release,代码行数:14,代码来源:UniqueStartScreen.java

示例11: initGUI

import javax.swing.JPanel; //导入方法依赖的package包/类
/**
 * 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);
}
 
开发者ID:transwarpio,项目名称:rapidminer,代码行数:72,代码来源:ConfigurableDialog.java

示例12: SimpleTableDemo

import javax.swing.JPanel; //导入方法依赖的package包/类
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);


}
 
开发者ID:liaokailin,项目名称:tomcat7,代码行数:73,代码来源:MapDemo.java

示例13: Renderer

import javax.swing.JPanel; //导入方法依赖的package包/类
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);

	}
}
 
开发者ID:equella,项目名称:Equella,代码行数:51,代码来源:FileListPanel.java

示例14: setupGUI

import javax.swing.JPanel; //导入方法依赖的package包/类
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)));
}
 
开发者ID:equella,项目名称:Equella,代码行数:47,代码来源:GeneralDialog.java

示例15: addNumpad

import javax.swing.JPanel; //导入方法依赖的package包/类
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);
	}
 
开发者ID:TeamRedFox,项目名称:PointOfSale,代码行数:48,代码来源:CheckoutFrame.java


注:本文中的javax.swing.JPanel.setMaximumSize方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。