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


Java JButton.setMaximumSize方法代码示例

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


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

示例1: createButtons

import javax.swing.JButton; //导入方法依赖的package包/类
void createButtons() {
    for (int i = 0; i < chars.length; i++) {
        JButton button = new JButton(new CharAction(chars[i]));
        button.setMaximumSize(new Dimension(50, 22));
        //button.setMinimumSize(new Dimension(22, 22));
        button.setPreferredSize(new Dimension(30, 22));
        button.setRequestFocusEnabled(false);
        button.setFocusable(false);
        button.setBorderPainted(false);
        button.setOpaque(false);
        button.setMargin(new Insets(0,0,0,0));
        button.setFont(new Font("serif", 0, 14));
        if (i == chars.length-1) {
            button.setText("nbsp");
            button.setFont(new Font("Dialog",0,10));
            button.setMargin(new Insets(0,0,0,0));
        }
        this.add(button, null);
    }
}
 
开发者ID:ser316asu,项目名称:Neukoelln_SER316,代码行数:21,代码来源:CharTablePanel.java

示例2: createArrowButton

import javax.swing.JButton; //导入方法依赖的package包/类
private JButton createArrowButton() {
    arrowMenu = new JPopupMenu();
    JButton button = DropDownButtonFactory.createDropDownButton(
        ImageUtilities.loadImageIcon("org/netbeans/modules/debugger/resources/debuggingView/unvisited_bpkt_arrow_small_16.png", false), arrowMenu);
    button.setPreferredSize(new Dimension(40, button.getPreferredSize().height)); // [TODO]
    button.setMaximumSize(new Dimension(40, button.getPreferredSize().height)); // [TODO]
    button.setFocusable(false);
    button.setOpaque(false);
    button.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            if (arrowMenu.getComponentCount() > 0) {
                Object item = arrowMenu.getComponent(0);
                for (Map.Entry<DVThread, JMenuItem> entry : threadToMenuItem.entrySet()) {
                    if (entry.getValue() == item) {
                        debuggingView.makeThreadCurrent(entry.getKey());
                    } // if
                } // for
            } // if
        } // actionPerformed
    });
    return button;
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:23,代码来源:InfoPanel.java

示例3: initComponents

import javax.swing.JButton; //导入方法依赖的package包/类
private void initComponents() {
	this.setBorder(new EmptyBorder(20, 20, 20, 20));
	this.setLayout(new BorderLayout(5, 5));

	addMeasureButton = new JButton(addMeasure);
	JPanel rightPanel = new JPanel(new BorderLayout(5, 5));
	rightPanel.add(addMeasureButton, BorderLayout.SOUTH);
	rightPanel.add(measureSelection, BorderLayout.CENTER);

	measureTable = new MeasureTable();

	JPanel headPanel = new JPanel(new BorderLayout(5, 5));
	headPanel.add(descrLabel, BorderLayout.CENTER);
	headPanel.add(rightPanel, BorderLayout.EAST);
	addMeasureButton.setMaximumSize(DIM_BUTTON_M);
	this.add(headPanel, BorderLayout.NORTH);
	warningPanel = new WarningScrollTable(measureTable, WARNING_CLASS_STATION);
	warningPanel.addCheckVector(classData.getClassKeys());
	warningPanel.addCheckVector(stationData.getStationRegionKeysNoSourceSink());
	this.add(warningPanel, BorderLayout.CENTER);
}
 
开发者ID:HOMlab,项目名称:QN-ACTR-Release,代码行数:22,代码来源:MeasurePanel.java

示例4: updateActionPane

import javax.swing.JButton; //导入方法依赖的package包/类
/**
 * 
 */
public void updateActionPane() {
	actions.removeAll();
	try {
		posActions = Main.guiControlller.getPossibleActions();
		String actionName;
		int i = 0;
		for (Action<?> posAction : posActions) {
			actionName = posAction.toString();
			JButton b1 = new JButton(actionName);
			b1.setHorizontalAlignment(SwingConstants.LEFT);
			b1.addActionListener(this);
			b1.setActionCommand(Integer.toString(i));
			b1.setMaximumSize(new Dimension(Integer.MAX_VALUE, b1.getMinimumSize().height));
			actions.add(b1);
			i++;
		}
		actions.revalidate();
		actions.repaint();
		this.repaint();


	} catch (Exception e) {
		Main.updateUserMsg(e.getMessage());
	}
}
 
开发者ID:tslaats,项目名称:SE2017-Team2,代码行数:29,代码来源:ActionPane.java

示例5: getTableCellEditorComponent

import javax.swing.JButton; //导入方法依赖的package包/类
@Override
public Component getTableCellEditorComponent(final JTable table, final Object value, final boolean isSelected, final int row, final int column) {
	final Component c = super.getTableCellEditorComponent(table, value, isSelected, row, column);
	final JButton button = new JButton("?");
	button.setMargin(new Insets(0, 0, 0, 0));
	button.setToolTipText(Column.WHO_IS.getLabel());
	button.setPreferredSize(new Dimension(Column.WHO_IS.getWidth(), c.getHeight()));
	button.setMaximumSize(button.getPreferredSize());
	if (Env.INSTANCE.getOs() == OS.win) {
		button.setBorder(null);
	}
	button.setEnabled(!_searching);
	button.addActionListener(e -> {
		final RoutePoint point = _route.getRoute().get(_table.convertRowIndexToModel(row));
		WhoIsPanel.showWhoIsDialog(RouteTablePanel.this, _services, point);
		if (table.isEditing()) {
			table.getCellEditor().stopCellEditing();
		}
		_whois.clear();
	});
	return button;
}
 
开发者ID:leolewis,项目名称:openvisualtraceroute,代码行数:23,代码来源:RouteTablePanel.java

示例6: jPanel_srEquipmentBrowseCategoriesComponentShown

import javax.swing.JButton; //导入方法依赖的package包/类
private void jPanel_srEquipmentBrowseCategoriesComponentShown(java.awt.event.ComponentEvent evt) {//GEN-FIRST:event_jPanel_srEquipmentBrowseCategoriesComponentShown
    if (!initializedEquipmentBrowse) {
        List<String> categories = mil2525CSymbolController.getCategories();
        for (final String category : categories) {
            final JButton button = new JButton(category);
            button.setFont(BUTTON_FONT);
            button.setHorizontalAlignment(SwingConstants.LEFT);
            button.setFocusable(false);
            button.addActionListener(new ActionListener() {

                public void actionPerformed(ActionEvent e) {
                    selectedCategory = category;
                    equipmentListJPanel_srEquipmentCategoryResults.removeAll();
                    jLabel_srEquipmentCategory.setText(selectedCategory);
                    showCard("Spot Report Equipment Category Card");
                }
            });
            button.setMaximumSize(new Dimension(Integer.MAX_VALUE, 60));
            button.setMinimumSize(new Dimension(0, 60));
            jPanel_srEquipmentCategories.add(button);
        }

        initializedEquipmentBrowse = true;
    }
}
 
开发者ID:Esri,项目名称:defense-solutions-proofs-of-concept,代码行数:26,代码来源:MainMenuJPanel.java

示例7: createButtons

import javax.swing.JButton; //导入方法依赖的package包/类
/**
 * @return a {@link JPanel} with {@link JButton}s to manipulate the network
 *         table: Move up, move down, add, remove.
 */
private JPanel createButtons() {
	JPanel bpanel = new JPanel();
	bpanel.setLayout(new BoxLayout(bpanel, BoxLayout.PAGE_AXIS));

	ActionListener listener = new ButtonHandler();
	JButton[] jbuttons = new JButton[4];
	String[] buttons = {
			UP_LBL,		UP_TIP, 	UP_ACTN,
			DOWN_LBL,	DOWN_TIP,	DOWN_ACTN,
			ADD_LBL,	ADD_TIP,	ADD_ACTN,
			REMOVE_LBL,	REMOVE_TIP,	REMOVE_ACTN
	};

	for (int i = 0; i < jbuttons.length; i++) {
		JButton button = new JButton();

		button.setText(buttons[i*3]);
		button.setToolTipText(buttons[i*3+1]);
		button.setActionCommand(buttons[i*3+2]);

		button.addActionListener(listener);
		button.setMaximumSize(new Dimension(
				Short.MAX_VALUE, button.getPreferredSize().height));

		bpanel.add(button);
		jbuttons[i] = button;

		if (i != jbuttons.length - 1) {
			bpanel.add(Box.createVerticalStrut(PADDING));
		}
	}

	this.moveUp = jbuttons[0];
	this.moveDown = jbuttons[1];
	this.add = jbuttons[2];
	this.remove = jbuttons[3];

	return bpanel;
}
 
开发者ID:KeepTheBeats,项目名称:alevin-svn2,代码行数:44,代码来源:MultiAlgoScenarioWizard.java

示例8: createDataSourceSelectionButton

import javax.swing.JButton; //导入方法依赖的package包/类
private JButton createDataSourceSelectionButton(@SuppressWarnings("rawtypes") final DataSourceFactory factory) {
	String label = DataImportWizardUtils.getFactoryLabel(factory);
	String description = DataImportWizardUtils.getFactoryDescription(factory);

	JButton typeSelectionButton = new JButton(new AbstractAction() {

		private static final long serialVersionUID = 1L;

		@Override
		@SuppressWarnings("unchecked")
		public void actionPerformed(ActionEvent e) {
			enableDataSourceButtons(false);

			// update the wizard by setting the selected factory
			wizard.setDataSource(factory.createNew(), factory);

			// switch to the next wizard step (location selection)
			wizard.nextStep();
		}

	});

	typeSelectionButton.setText(label);
	typeSelectionButton.setToolTipText(description);

	typeSelectionButton.setMinimumSize(TYPE_BUTTON_DIMENSION);
	typeSelectionButton.setPreferredSize(TYPE_BUTTON_DIMENSION);
	typeSelectionButton.setMaximumSize(TYPE_BUTTON_DIMENSION);
	typeSelectionButton.setIcon(DataImportWizardUtils.getFactoryIcon(factory));

	return typeSelectionButton;
}
 
开发者ID:transwarpio,项目名称:rapidminer,代码行数:33,代码来源:TypeSelectionView.java

示例9: generateControl

import javax.swing.JButton; //导入方法依赖的package包/类
@Override
public JComponent generateControl()
{
	field = new JTextField();
	field.setMaximumSize(new Dimension(Short.MAX_VALUE, 20));

	if( items.size() >= 1 )
	{
		field.setText(((Item) items.get(0)).getValue());
	}

	JButton browse = new JButton("Browse");
	browse.setIcon(new ImageIcon(getClass().getResource("/images/browse.gif")));
	browse.setHorizontalTextPosition(SwingConstants.RIGHT);
	Dimension browseSize = browse.getPreferredSize();
	browseSize.height = 20;
	browse.setMaximumSize(browseSize);
	browse.addActionListener(this);

	JPanel group = new JPanel();
	group.setLayout(new BoxLayout(group, BoxLayout.X_AXIS));
	group.add(field);
	group.add(Box.createRigidArea(new Dimension(5, 0)));
	group.add(browse);
	group.setAlignmentX(Component.LEFT_ALIGNMENT);

	return group;
}
 
开发者ID:equella,项目名称:Equella,代码行数:29,代码来源:GResourceSelector.java

示例10: createGUI

import javax.swing.JButton; //导入方法依赖的package包/类
protected void createGUI()
{
	GridBagLayout gridbag = new GridBagLayout();
	GridBagConstraints c = new GridBagConstraints();

	setLayout(gridbag);
	setMaximumSize(new Dimension(Short.MAX_VALUE, Short.MAX_VALUE));

	target = new JTextField();
	target.setEditable(false);
	target.setMinimumSize(new Dimension(150, 20));
	target.setPreferredSize(new Dimension(150, 20));
	target.setMaximumSize(new Dimension(150, 20));
	c.gridx = 0;
	c.weightx = 1;
	c.gridy = 0;
	c.fill = GridBagConstraints.HORIZONTAL;
	gridbag.setConstraints(target, c);
	add(target);

	search = new JButton("...");
	search.setFont(new Font("Sans Serif", Font.PLAIN, 8));
	search.addActionListener(this);
	search.setMinimumSize(new Dimension(18, 20));
	search.setPreferredSize(new Dimension(18, 20));
	search.setMaximumSize(new Dimension(18, 20));

	c.gridx = 1;
	c.weightx = 0;
	gridbag.setConstraints(search, c);
	add(search);
}
 
开发者ID:equella,项目名称:Equella,代码行数:33,代码来源:WhereTargetChooser.java

示例11: createGUI

import javax.swing.JButton; //导入方法依赖的package包/类
private void createGUI()
{
	GridBagLayout gridbag = new GridBagLayout();
	GridBagConstraints c = new GridBagConstraints();

	setLayout(gridbag);
	setMaximumSize(new Dimension(Short.MAX_VALUE, Short.MAX_VALUE));

	target = new JTextField();
	target.setEditable(false);
	target.setMinimumSize(new Dimension(150, 20));
	target.setPreferredSize(new Dimension(150, 20));
	target.setMaximumSize(new Dimension(150, 20));
	c.gridx = 0;
	c.weightx = 1;
	c.gridy = 0;
	c.fill = GridBagConstraints.HORIZONTAL;
	gridbag.setConstraints(target, c);
	add(target);

	JButton search = new JButton("..."); //$NON-NLS-1$
	search.setFont(new Font("Sans Serif", Font.PLAIN, 8)); //$NON-NLS-1$
	search.addActionListener(new SearchHandler());
	search.setMinimumSize(new Dimension(18, 20));
	search.setPreferredSize(new Dimension(18, 20));
	search.setMaximumSize(new Dimension(18, 20));
	c.gridx = 1;
	c.weightx = 0;
	gridbag.setConstraints(search, c);
	add(search);
}
 
开发者ID:equella,项目名称:Equella,代码行数:32,代码来源:ScriptTargetChooser.java

示例12: setEquipmentNames

import javax.swing.JButton; //导入方法依赖的package包/类
/**
 * Sets the names of the equipment for which buttons should display.
 * @param equipmentNames the names of the equipment for which buttons should display.
 */
public void setEquipmentNames(List<String> equipmentNames) {
    removeAll();

    for (final String name : equipmentNames) {
        JButton button = new JButton(name) {
            @Override
            public void paint(Graphics g) {
                if (null == getIcon()) {
                    //Doing this here because it's expensive, so only
                    //do it when we actually need it.
                    setIcon(new ImageIcon(mil2525CSymbolController.getSymbolImage(name)));
                }
                super.paint(g);
            }
        };
        button.setFont(BUTTON_FONT);
        button.setHorizontalAlignment(SwingConstants.LEFT);
        button.setFocusable(false);
        button.setMaximumSize(new Dimension(Integer.MAX_VALUE, 60));
        button.setMinimumSize(new Dimension(0, 60));
        button.addActionListener(new ActionListener() {

            public void actionPerformed(ActionEvent e) {
                for (ActionListener listener : listeners) {
                    listener.actionPerformed(e);
                }
            }
        });
        add(button);
    }
}
 
开发者ID:Esri,项目名称:defense-solutions-proofs-of-concept,代码行数:36,代码来源:EquipmentListJPanel.java

示例13: initComponents

import javax.swing.JButton; //导入方法依赖的package包/类
protected void initComponents() {
	//create margins for this panel.
	Box vBox = Box.createVerticalBox();
	Box hBox = Box.createHorizontalBox();
	vBox.add(Box.createVerticalStrut(30));
	vBox.add(hBox);
	vBox.add(Box.createVerticalStrut(30));
	hBox.add(Box.createHorizontalStrut(20));

	//build central panel
	JPanel componentsPanel = new JPanel(new BorderLayout());
	//new BoxLayout(componentsPanel, BoxLayout.Y_AXIS);

	//build upper part of central panel
	JPanel upperPanel = new JPanel(new BorderLayout());
	JLabel descrLabel = new JLabel(CLASSES_DESCRIPTION);
	//descrLabel.setMaximumSize(new Dimension(300, 1000));
	upperPanel.add(descrLabel, BorderLayout.CENTER);

	//build upper right corner of the main panel
	JPanel upRightPanel = new JPanel(new BorderLayout());
	addClass = new JButton(addNewClass);
	addClass.setMinimumSize(DIM_BUTTON_S);
	addClass.setMaximumSize(DIM_BUTTON_S);
	upRightPanel.add(addClass, BorderLayout.NORTH);

	//build spinner panel
	JPanel spinnerPanel = new JPanel();
	JLabel spinnerDescrLabel = new JLabel("Classes:");
	//rangesNumSpinner = new JSpinner();
	classNumSpinner.setPreferredSize(DIM_BUTTON_XS);
	spinnerPanel.add(spinnerDescrLabel);
	spinnerPanel.add(classNumSpinner);

	//add all panels to the mail panel
	upRightPanel.add(spinnerPanel, BorderLayout.CENTER);
	upperPanel.add(upRightPanel, BorderLayout.EAST);
	componentsPanel.add(upperPanel, BorderLayout.NORTH);
	componentsPanel.add(new JScrollPane(classTable), BorderLayout.CENTER);
	hBox.add(componentsPanel);
	hBox.add(Box.createHorizontalStrut(20));
	this.setLayout(new GridLayout(1, 1));
	this.add(vBox);
}
 
开发者ID:max6cn,项目名称:jmt,代码行数:45,代码来源:ClassesPanel.java


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