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


Java JButton.getPreferredSize方法代码示例

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


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

示例1: createSouth

import javax.swing.JButton; //导入方法依赖的package包/类
private JComponent createSouth()
{
	scriptingLabel = new JLabel();
	scriptingButton = new JButton(CurrentLocale.get("com.tle.admin.workflow.editor.decisioneditor.open"));

	scriptingButton.addActionListener(this);

	final int width1 = scriptingButton.getPreferredSize().width;
	final int height1 = scriptingButton.getPreferredSize().height;

	final int[] rows = {height1,};
	final int[] cols = {width1, TableLayout.FILL,};

	final JPanel all = new JPanel(new TableLayout(rows, cols));
	all.add(scriptingLabel, new Rectangle(1, 0, 1, 1));
	all.add(scriptingButton, new Rectangle(0, 0, 1, 1));

	updateScriptMessage();

	return all;
}
 
开发者ID:equella,项目名称:Equella,代码行数:22,代码来源:DecisionEditor.java

示例2: fixSize

import javax.swing.JButton; //导入方法依赖的package包/类
private void fixSize(JToolBar actionBar) {
    Insets ins = actionBar.getMargin();
    JButton dummy = new JButton();
    dummy.setBorderPainted(false);
    dummy.setOpaque(false);
    dummy.setText(null);
    dummy.setIcon(new Icon() {

 @Override
        public int getIconHeight() {
            return 16;
        }

 @Override
        public int getIconWidth() {
            return 16;
        }

        @SuppressWarnings(value = "empty-statement")
 @Override
        public void paintIcon(Component c, Graphics g, int x, int y) {
            ;
        }
    });
    actionBar.add(dummy);
    Dimension buttonPref = dummy.getPreferredSize();
    Dimension minDim = new Dimension(buttonPref.width + ins.left + ins.right, buttonPref.height + ins.top + ins.bottom);
    actionBar.setMinimumSize(minDim);
    actionBar.setPreferredSize(minDim);
    actionBar.remove(dummy);
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:32,代码来源:TerminalContainerCommon.java

示例3: 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

示例4: setupGui

import javax.swing.JButton; //导入方法依赖的package包/类
private void setupGui()
{
	JLabel typeLabel = new JLabel(CurrentLocale.get("com.tle.admin.schema.manager.transformdialog.name")); //$NON-NLS-1$
	JLabel fileLabel = new JLabel(CurrentLocale.get("com.tle.admin.schema.manager.transformdialog.xsl")); //$NON-NLS-1$

	schemaType = new JComboBox();
	schemaType.setEditable(true);
	fileSelector = new FileSelector(CurrentLocale.get("com.tle.admin.schema.manager.transformdialog.browse")); //$NON-NLS-1$
	fileSelector.setFileFilter(FileFilterAdapter.XSLT());

	ok = new JButton(CurrentLocale.get("com.tle.admin.ok")); //$NON-NLS-1$
	JButton cancel = new JButton(CurrentLocale.get("com.tle.admin.cancel")); //$NON-NLS-1$

	ok.addActionListener(this);
	cancel.addActionListener(this);

	final int height1 = typeLabel.getPreferredSize().height;
	final int height2 = schemaType.getPreferredSize().height;
	final int height3 = fileSelector.getPreferredSize().height;
	final int height4 = ok.getPreferredSize().height;
	final int width1 = cancel.getPreferredSize().width;

	final int[] rows = {height1, height2, height1, height3, height4,};
	final int[] cols = {TableLayout.FILL, width1, width1,};

	all = new JPanel(new TableLayout(rows, cols));
	all.setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 5));

	all.add(typeLabel, new Rectangle(0, 0, 3, 1));
	all.add(schemaType, new Rectangle(0, 1, 3, 1));
	all.add(fileLabel, new Rectangle(0, 2, 3, 1));
	all.add(fileSelector, new Rectangle(0, 3, 3, 1));
	all.add(ok, new Rectangle(1, 4, 1, 1));
	all.add(cancel, new Rectangle(2, 4, 1, 1));
}
 
开发者ID:equella,项目名称:Equella,代码行数:36,代码来源:TransformDialog.java

示例5: setup

import javax.swing.JButton; //导入方法依赖的package包/类
private void setup()
{
	calendar = new JCalendar();

	select = new JButton("Select Date");
	close = new JButton("Close");

	select.addActionListener(this);
	close.addActionListener(this);

	final int width1 = select.getPreferredSize().width;
	final int width2 = close.getPreferredSize().width;
	final int height = select.getPreferredSize().height;

	final int[] rows = {TableLayout.FILL, height};
	final int[] cols = {TableLayout.FILL, width1, width2};

	JPanel all = new JPanel(new TableLayout(rows, cols, 5, 5));
	all.setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 5));

	all.add(calendar, new Rectangle(0, 0, 3, 1));
	all.add(select, new Rectangle(1, 1, 1, 1));
	all.add(close, new Rectangle(2, 1, 1, 1));

	getContentPane().add(all);
	setSize(450, 300);

	ComponentHelper.centreOnScreen(this);
}
 
开发者ID:equella,项目名称:Equella,代码行数:30,代码来源:CalendarDialog.java

示例6: setupSelectedPanel

import javax.swing.JButton; //导入方法依赖的package包/类
private JComponent setupSelectedPanel(ChangeDetector changeDetector)
{
	actions.add(upAction);
	actions.add(downAction);
	actions.add(removeAction);

	selectedModel = new MyTableModel();
	selectedTable = createTable(selectedModel);
	selectedTable.getSelectionModel().setSelectionMode(ListSelectionModel.MULTIPLE_INTERVAL_SELECTION);
	selectedTable.addMouseListener(new TablePopupListener(selectedTable, removeAction, upAction, downAction));
	selectedTable.getSelectionModel().addListSelectionListener(new ListSelectionListener()
	{
		@Override
		public void valueChanged(ListSelectionEvent e)
		{
			update();
		}
	});

	JButton up = new JTextlessButton(upAction);
	JButton down = new JTextlessButton(downAction);
	JButton remove = new JButton(removeAction);

	final int width1 = up.getPreferredSize().width;
	final int width2 = remove.getPreferredSize().width;
	final int height1 = up.getPreferredSize().height;
	final int height2 = remove.getPreferredSize().height;
	final int[] rows = {TableLayout.FILL, height1, height1, TableLayout.FILL, height2,};
	final int[] cols = {width1, TableLayout.FILL, width2,};

	JPanel all = new JPanel(new TableLayout(rows, cols));
	all.add(new JScrollPane(selectedTable), new Rectangle(1, 0, 2, 4));
	all.add(up, new Rectangle(0, 1, 1, 1));
	all.add(down, new Rectangle(0, 2, 1, 1));
	all.add(remove, new Rectangle(2, 4, 1, 1));

	changeDetector.watch(selectedModel);

	return all;
}
 
开发者ID:equella,项目名称:Equella,代码行数:41,代码来源:KeyResourcesTab.java

示例7: setup

import javax.swing.JButton; //导入方法依赖的package包/类
private void setup()
{
	changeDetector = new ChangeDetector();
	pane = generatePanel();

	save = new JButton(EditorHelper.DEFAULT_SAVE_TEXT);
	close = new JButton(EditorHelper.DEFAULT_CLOSE_TEXT);

	save.addActionListener(this);
	close.addActionListener(this);

	save.setEnabled(false);

	final int width1 = close.getPreferredSize().width;
	final int height1 = close.getPreferredSize().height;

	final Dimension dim1 = pane.getLayoutSizes();
	if( dim1.width != TableLayout.FILL )
	{
		dim1.width -= width1 * 2;
	}

	final int[] rows = {dim1.height, height1,};
	final int[] cols = {dim1.width, width1, width1,};

	setLayout(new TableLayout(rows, cols));
	setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 5));

	add(pane, new Rectangle(0, 0, 3, 1));
	add(save, new Rectangle(1, 1, 1, 1));
	add(close, new Rectangle(2, 1, 1, 1));
}
 
开发者ID:equella,项目名称:Equella,代码行数:33,代码来源:NodeEditor.java

示例8: TransformationsPanel

import javax.swing.JButton; //导入方法依赖的package包/类
public TransformationsPanel(RemoteAdminService adminService, EditorState<Schema> state, boolean handleImports)
{
	this.adminService = adminService;
	this.state = state;
	this.handleImports = handleImports;

	model = new MyTableModel();
	table = new JTable(model);
	table.getSelectionModel().setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
	table.getSelectionModel().addListSelectionListener(this);

	add = new JButton(CurrentLocale.get("com.tle.admin.add")); //$NON-NLS-1$
	edit = new JButton(CurrentLocale.get("com.tle.admin.edit")); //$NON-NLS-1$
	remove = new JButton(CurrentLocale.get("com.tle.admin.remove")); //$NON-NLS-1$

	add.addActionListener(this);
	edit.addActionListener(this);
	remove.addActionListener(this);

	JScrollPane tableScroll = new JScrollPane(table);

	final int height1 = add.getPreferredSize().height;
	final int width1 = remove.getPreferredSize().width;

	final int[] rows = {height1, height1, height1, TableLayout.FILL,};
	final int[] cols = {TableLayout.FILL, width1,};

	setLayout(new TableLayout(rows, cols));

	add(tableScroll, new Rectangle(0, 0, 1, 4));
	add(add, new Rectangle(1, 0, 1, 1));
	add(edit, new Rectangle(1, 1, 1, 1));
	add(remove, new Rectangle(1, 2, 1, 1));

	updateButtons();
}
 
开发者ID:equella,项目名称:Equella,代码行数:37,代码来源:TransformationsPanel.java

示例9: setupGui

import javax.swing.JButton; //导入方法依赖的package包/类
private void setupGui()
{
	JLabel instruction = new JLabel(CurrentLocale.get("com.tle.admin.itemdefinition.mapping.schemalist.choose")); //$NON-NLS-1$

	alreadyChosen = new JLabel(CurrentLocale.get("com.tle.admin.itemdefinition.mapping.schemalist.selected")); //$NON-NLS-1$
	alreadyChosen.setForeground(Color.RED);

	chooser = new SingleTargetChooser(schema, null);
	chooser.addTargetListener(this);

	ok = new JButton(CurrentLocale.get("com.tle.admin.ok")); //$NON-NLS-1$
	cancel = new JButton(CurrentLocale.get("com.tle.admin.cancel")); //$NON-NLS-1$

	ok.addActionListener(this);
	cancel.addActionListener(this);

	final int height1 = instruction.getPreferredSize().height;
	final int height2 = chooser.getPreferredSize().height;
	final int height3 = cancel.getPreferredSize().height;
	final int width1 = cancel.getPreferredSize().width;

	final int[] rows = {height1, height2, height1, height3,};
	final int[] cols = {TableLayout.FILL, width1, width1,};

	content = new JPanel(new TableLayout(rows, cols));
	content.setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 5));

	content.add(instruction, new Rectangle(0, 0, 3, 1));
	content.add(chooser, new Rectangle(0, 1, 3, 1));
	content.add(alreadyChosen, new Rectangle(0, 2, 3, 1));
	content.add(ok, new Rectangle(1, 3, 1, 1));
	content.add(cancel, new Rectangle(2, 3, 1, 1));

	updateGui(chooser.getTarget());
}
 
开发者ID:equella,项目名称:Equella,代码行数:36,代码来源:SchemaList.java

示例10: setup

import javax.swing.JButton; //导入方法依赖的package包/类
private void setup()
{
	JLabel label = new JLabel(getTitle());

	model = new DefaultListModel();
	list = new JList(model);
	list.setCellRenderer(new Renderer(repository));
	list.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
	list.addListSelectionListener(this);
	list.addMouseListener(this);

	ok = new JButton("OK");
	cancel = new JButton("Cancel");

	ok.addActionListener(this);
	cancel.addActionListener(this);

	final int height1 = label.getPreferredSize().height;
	final int height2 = ok.getPreferredSize().height;
	final int width1 = cancel.getPreferredSize().width;

	final int[] rows = {height1, TableLayout.FILL, height2,};
	final int[] cols = {TableLayout.FILL, width1, width1,};

	content = new JPanel(new TableLayout(rows, cols));
	content.setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 5));

	content.add(label, new Rectangle(0, 0, 3, 1));
	content.add(new JScrollPane(list), new Rectangle(0, 1, 3, 1));
	content.add(ok, new Rectangle(1, 2, 1, 1));
	content.add(cancel, new Rectangle(2, 2, 1, 1));

	updateButtons();
}
 
开发者ID:equella,项目名称:Equella,代码行数:35,代码来源:ControlDialog.java

示例11: setup

import javax.swing.JButton; //导入方法依赖的package包/类
private void setup()
{
	JLabel label = new JLabel(CurrentLocale.get("com.tle.admin.workflow.stepdialog.title"));

	model = new GenericListModel<Class<? extends WorkflowNode>>();
	list = new JList(model);
	list.setCellRenderer(new WorkflowCellRenderer());
	list.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
	list.addListSelectionListener(this);
	list.addMouseListener(this);

	ok = new JButton(CurrentLocale.get("com.tle.admin.ok"));
	cancel = new JButton(CurrentLocale.get("com.tle.admin.cancel"));

	ok.addActionListener(this);
	cancel.addActionListener(this);

	final int height1 = label.getPreferredSize().height;
	final int height2 = ok.getPreferredSize().height;
	final int width1 = cancel.getPreferredSize().width;

	final int[] rows = {height1, TableLayout.FILL, height2,};
	final int[] cols = {TableLayout.FILL, width1, width1,};

	content = new JPanel(new TableLayout(rows, cols));
	content.setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 5));

	content.add(label, new Rectangle(0, 0, 3, 1));
	content.add(new JScrollPane(list), new Rectangle(0, 1, 3, 1));
	content.add(ok, new Rectangle(1, 2, 1, 1));
	content.add(cancel, new Rectangle(2, 2, 1, 1));

	updateButtons();
}
 
开发者ID:equella,项目名称:Equella,代码行数:35,代码来源:StepDialog.java

示例12: setupGUI

import javax.swing.JButton; //导入方法依赖的package包/类
private void setupGUI(RecipientFilter... filters)
{
	JLabel queryText = new JLabel(CurrentLocale.get("searching.userGroupRole.beforeQuery"));
	JLabel filterText = new JLabel(CurrentLocale.get("searching.userGroupRole.beforeFilters"));
	JLabel resultsText = new JLabel(CurrentLocale.get("searching.userGroupRole.results"));

	queryText.setHorizontalAlignment(SwingConstants.RIGHT);
	filterText.setHorizontalAlignment(SwingConstants.RIGHT);
	resultsText.setHorizontalAlignment(SwingConstants.RIGHT);

	JComponent filterPanel = createFilterPanel(filters);

	query = new JTextField();
	query.addActionListener(this);

	search = new JButton(CurrentLocale.get("searching.userGroupRole.executeQuery"));
	search.addActionListener(this);

	resultsModel = new GenericListModel<Object>();
	results = new JList(resultsModel);
	results.addListSelectionListener(this);
	setSingleSelectionOnly(false);

	JScrollPane resultsScroller = new JScrollPane(results);
	resultsScroller.setVerticalScrollBarPolicy(ScrollPaneConstants.VERTICAL_SCROLLBAR_ALWAYS);

	final int height1 = query.getPreferredSize().height;
	final int height2 = filterPanel == null ? TableLayout.INVISIBLE : filterPanel.getPreferredSize().height;
	final int height3 = resultsText.getPreferredSize().height;
	final int width1 = queryText.getPreferredSize().width;
	final int width2 = search.getPreferredSize().width;

	final int[] rows = {height1, height2, height3, TableLayout.FILL,};
	final int[] cols = {width1, TableLayout.FILL, width2,};

	setLayout(new TableLayout(rows, cols));
	add(queryText, new Rectangle(0, 0, 1, 1));
	add(query, new Rectangle(1, 0, 1, 1));
	add(search, new Rectangle(2, 0, 1, 1));
	if( filterPanel != null )
	{
		add(filterText, new Rectangle(0, 1, 1, 1));
		add(filterPanel, new Rectangle(1, 1, 2, 1));
	}
	add(resultsText, new Rectangle(0, 2, 1, 1));
	add(resultsScroller, new Rectangle(1, 2, 2, 2));
}
 
开发者ID:equella,项目名称:Equella,代码行数:48,代码来源:SearchFinder.java

示例13: IOWindowImpl

import javax.swing.JButton; //导入方法依赖的package包/类
public IOWindowImpl() {
    pane = TabbedPaneFactory.createCloseButtonTabbedPane();
    pane.addChangeListener(this);
    pane.addPropertyChangeListener(TabbedPaneFactory.PROP_CLOSE, this);
    setFocusable(true);

    toolbar = new ToolbarWithOverflow();
    toolbar.setOrientation(JToolBar.VERTICAL);
    toolbar.setLayout(new BoxLayout(toolbar, BoxLayout.Y_AXIS));
    toolbar.setFloatable(false);
    Insets ins = toolbar.getMargin();
    JButton sample = new JButton();
    sample.setBorderPainted(false);
    sample.setOpaque(false);
    sample.setText(null);
    sample.setIcon(new Icon() {

        public int getIconHeight() {
            return 16;
        }

        public int getIconWidth() {
            return 16;
        }

        public void paintIcon(Component c, Graphics g, int x, int y) {
        }
    });
    toolbar.add(sample);
    Dimension buttonPref = sample.getPreferredSize();
    Dimension minDim = new Dimension(buttonPref.width + ins.left + ins.right, buttonPref.height + ins.top + ins.bottom);
    toolbar.setMinimumSize(minDim);
    toolbar.setPreferredSize(minDim);
    toolbar.remove(sample);
    setLayout(new BorderLayout());
    add(toolbar, BorderLayout.WEST);
    toolbar.setBorder(new VariableRightBorder(pane));
    toolbar.setBorderPainted(true);

    popupMenu = new JPopupMenu();
    popupMenu.add(new Close());
    popupMenu.add(new CloseAll());
    popupMenu.add(new CloseOthers());
    pane.addMouseListener(new MouseUtils.PopupMouseAdapter() {

        @Override
        protected void showPopup(MouseEvent evt) {
            popupMenu.show(IOWindowImpl.this, evt.getX(), evt.getY());
        }
    });
    pane.addMouseListener(new MouseAdapter() { // #221375
        @Override
        public void mouseClicked(MouseEvent e) {
            if (SwingUtilities.isLeftMouseButton(e)) {
                requestActive();
            }
        }
    });

    String name = NbBundle.getMessage(IOWindow.class, "LBL_IO_WINDOW");
    setDisplayName(name); //NOI18N
    setToolTipText(name);
    // setting name to satisfy the accesible name requirement for window.
    setName(name); //NOI18N

    setIcon(ImageUtilities.loadImage(ICON_RESOURCE)); // NOI18N
    // special title for sliding mode
    // XXX - please rewrite to regular API when available - see issue #55955
    putClientProperty("SlidingName", getDisplayName()); //NOI18N
    if (AQUA) {
        setBackground(UIManager.getColor("NbExplorerView.background"));
        setOpaque(true);
        toolbar.setBackground(UIManager.getColor("NbExplorerView.background"));
        pane.setBackground(UIManager.getColor("NbExplorerView.background"));
        pane.setOpaque(true);
        setMinimumSize(new Dimension()); // #254566
    }
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:79,代码来源:IOWindow.java

示例14: setupGUI

import javax.swing.JButton; //导入方法依赖的package包/类
@SuppressWarnings("nls")
private void setupGUI(Node privNode, PrivilegeList accessModel)
{
	JButton add = new JButton(addAction);
	JButton remove = new JButton(removeAction);
	JButton up = new JTextlessButton(upAction);
	JButton down = new JTextlessButton(downAction);

	privilegeModel = new MyTableModel(privNode, accessModel);
	privilegeTable = new JTable(privilegeModel);
	privilegeTable.addMouseListener(new TablePopupListener(privilegeTable, actions));

	ListSelectionModel selectionModel = privilegeTable.getSelectionModel();
	selectionModel.addListSelectionListener(this);
	selectionModel.setSelectionMode(ListSelectionModel.MULTIPLE_INTERVAL_SELECTION);

	TableColumn actionColumn = privilegeTable.getColumnModel().getColumn(0);
	actionColumn.setCellRenderer(new ActionTableCellRenderer());
	actionColumn.setCellEditor(new ActionTableCellEditor());

	TableColumn whoColumn = privilegeTable.getColumnModel().getColumn(1);
	whoColumn.setCellRenderer(new ExpressionTableCellRenderer(userService));
	whoColumn.setCellEditor(new WhoTableCellEditor(userService, this));

	JScrollPane scroller = new JScrollPane(privilegeTable);

	final int height1 = add.getPreferredSize().height;
	final int width1 = remove.getPreferredSize().width;
	final int[] rows = {height1, height1, height1, height1, TableLayout.FILL,};
	final int[] cols = {TableLayout.FILL, width1,};

	JPanel all = new JPanel(new TableLayout(rows, cols));
	all.add(scroller, new Rectangle(0, 0, 1, 5));
	all.add(add, new Rectangle(1, 0, 1, 1));
	all.add(remove, new Rectangle(1, 1, 1, 1));
	all.add(up, new Rectangle(1, 2, 1, 1));
	all.add(down, new Rectangle(1, 3, 1, 1));

	showOverrides = new JCheckBox(
		CurrentLocale.get("com.tle.admin.security.editors.advancededitorpanel.overriding"));
	showDefaults = new JCheckBox(CurrentLocale.get("com.tle.admin.security.editors.advancededitorpanel.default"));

	showOverrides.addActionListener(this);
	showDefaults.addActionListener(this);

	final int mainHeight1 = showOverrides.getPreferredSize().height;
	final int[] mainRows = {TableLayout.INVISIBLE, TableLayout.FILL, TableLayout.INVISIBLE, mainHeight1,};
	final int[] mainCols = {TableLayout.FILL, TableLayout.FILL, width1,};
	layout = new TableLayout(mainRows, mainCols);
	setLayout(layout);

	add(new JLabel(CurrentLocale.get("com.tle.admin.security.editors.advancededitorpanel.overrides")),
		new Rectangle(2, 0, 1, 1));
	add(all, new Rectangle(0, 1, 3, 1));
	add(new JLabel(CurrentLocale.get("com.tle.admin.security.editors.advancededitorpanel.defaults")),
		new Rectangle(2, 2, 1, 1));
	add(showOverrides, new Rectangle(0, 3, 1, 1));
	add(showDefaults, new Rectangle(1, 3, 1, 1));

	updateButtons();
}
 
开发者ID:equella,项目名称:Equella,代码行数:62,代码来源:AdvancedEditorPanel.java

示例15: createCentre

import javax.swing.JButton; //导入方法依赖的package包/类
private JComponent createCentre()
{
	final JButton add = new JButton(addAction);
	final JButton modify = new JButton(modifyAction);
	final JButton delete = new JButton(removeAction);
	final JButton preview = new JButton(previewAction);
	final JButton up = new JTextlessButton(upAction);
	final JButton down = new JTextlessButton(downAction);

	model = new WorkflowTreeModel();
	tree = new WorkflowTree(model, clientService.getService(RemoteUserService.class),
		clientService.getService(RemoteSchemaService.class));
	tree.addTreeSelectionListener(new TreeSelectionListener()
	{
		@Override
		public void valueChanged(final TreeSelectionEvent e)
		{
			updateButtons();
		}
	});
	tree.addMouseListener(new TreeDoubleClickListener(tree, modifyAction));
	tree.addMouseListener(new TreePopupListener(tree, actions));

	final JScrollPane scroll = new JScrollPane(tree);
	scroll.getViewport().setBackground(Color.WHITE);

	final int width1 = up.getPreferredSize().width;
	final int width2 = Math.max(preview.getPreferredSize().width, delete.getPreferredSize().width);
	final int height1 = up.getPreferredSize().height;
	final int height2 = delete.getPreferredSize().height;

	final int[] rows = {TableLayout.FILL, height1, height1, TableLayout.FILL, height2};
	final int[] cols = {width1, TableLayout.FILL, width2, width2, width2, width2, TableLayout.FILL,};

	final JPanel buttons = new JPanel(new TableLayout(rows, cols));

	int row = 0;
	buttons.add(scroll, new Rectangle(1, row++, 6, 4));
	buttons.add(up, new Rectangle(0, row++, 1, 1));
	buttons.add(down, new Rectangle(0, row++, 1, 1));
	row++;
	buttons.add(add, new Rectangle(2, row, 1, 1));
	buttons.add(modify, new Rectangle(3, row, 1, 1));
	buttons.add(delete, new Rectangle(4, row, 1, 1));
	buttons.add(preview, new Rectangle(5, row, 1, 1));

	return buttons;
}
 
开发者ID:equella,项目名称:Equella,代码行数:49,代码来源:StepsTab.java


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