當前位置: 首頁>>代碼示例>>Java>>正文


Java BandedPanel類代碼示例

本文整理匯總了Java中com.trollworks.toolkit.ui.widget.BandedPanel的典型用法代碼示例。如果您正苦於以下問題:Java BandedPanel類的具體用法?Java BandedPanel怎麽用?Java BandedPanel使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


BandedPanel類屬於com.trollworks.toolkit.ui.widget包,在下文中一共展示了BandedPanel類的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: MenuKeyPreferences

import com.trollworks.toolkit.ui.widget.BandedPanel; //導入依賴的package包/類
/**
 * Creates a new {@link MenuKeyPreferences}.
 *
 * @param owner The owning {@link PreferencesWindow}.
 */
public MenuKeyPreferences(PreferencesWindow owner) {
	super(MENU_KEYS, owner);
	setLayout(new BorderLayout());
	mPanel = new BandedPanel(MENU_KEYS);
	mPanel.setLayout(new ColumnLayout(2, 5, 0));
	mPanel.setBorder(new EmptyBorder(2, 5, 2, 5));
	mPanel.setOpaque(true);
	mPanel.setBackground(Color.WHITE);
	for (Command cmd : StdMenuBar.getCommands()) {
		JButton button = new JButton(KeyStrokeDisplay.getKeyStrokeDisplay(KeyStroke.getKeyStroke('Z', InputEvent.META_MASK | InputEvent.ALT_MASK | InputEvent.CTRL_MASK | InputEvent.SHIFT_MASK)));
		UIUtilities.setOnlySize(button, button.getPreferredSize());
		button.setText(getAcceleratorText(cmd));
		mMap.put(button, cmd);
		button.addActionListener(this);
		mPanel.add(button);
		JLabel label = new JLabel(cmd.getTitle());
		mPanel.add(label);
	}
	mPanel.setSize(mPanel.getPreferredSize());
	JScrollPane scroller = new JScrollPane(mPanel);
	Dimension preferredSize = scroller.getPreferredSize();
	if (preferredSize.height > 200) {
		preferredSize.height = 200;
	}
	scroller.setPreferredSize(preferredSize);
	add(scroller);
}
 
開發者ID:Ayutac,項目名稱:toolkit,代碼行數:33,代碼來源:MenuKeyPreferences.java

示例2: ReferenceLookupPreferences

import com.trollworks.toolkit.ui.widget.BandedPanel; //導入依賴的package包/類
/**
 * Creates a new {@link ReferenceLookupPreferences}.
 *
 * @param owner The owning {@link PreferencesWindow}.
 */
public ReferenceLookupPreferences(PreferencesWindow owner) {
    super(TITLE, owner);
    setLayout(new BorderLayout());
    mPanel = new BandedPanel(TITLE);
    mPanel.setLayout(new ColumnLayout(4, 5, 0));
    mPanel.setBorder(new EmptyBorder(2, 5, 2, 5));
    mPanel.setOpaque(true);
    mPanel.setBackground(Color.WHITE);
    for (PdfRef ref : PdfRef.getKnown(false)) {
        JButton button = new JButton(REMOVE);
        UIUtilities.setOnlySize(button, button.getPreferredSize());
        button.addActionListener(event -> {
            ref.remove();
            Component[] children = mPanel.getComponents();
            for (int i = 0; i < children.length; i++) {
                if (children[i] == button) {
                    for (int j = i + 4; --j >= i;) {
                        mPanel.remove(j);
                    }
                    mPanel.setSize(mPanel.getPreferredSize());
                    break;
                }
            }
        });
        mPanel.add(button);
        JLabel idLabel = new JLabel(ref.getId(), SwingConstants.CENTER);
        idLabel.setBorder(new CompoundBorder(new LineBorder(), new EmptyBorder(1, 4, 1, 4)));
        idLabel.setOpaque(true);
        idLabel.setBackground(Color.YELLOW);
        mPanel.add(idLabel);
        EditorField field = new EditorField(new DefaultFormatterFactory(new IntegerFormatter(-9999, 9999, true)), event -> {
            ref.setPageToIndexOffset(((Integer) event.getNewValue()).intValue());
        }, SwingConstants.RIGHT, Integer.valueOf(ref.getPageToIndexOffset()), Integer.valueOf(-9999), OFFSET_FIELD_TOOLTIP);
        mPanel.add(field);
        mPanel.add(new JLabel(ref.getFile().getAbsolutePath()));
    }
    mPanel.setSize(mPanel.getPreferredSize());
    JScrollPane scroller = new JScrollPane(mPanel);
    Dimension preferredSize = scroller.getPreferredSize();
    if (preferredSize.height > 200) {
        preferredSize.height = 200;
    }
    scroller.setPreferredSize(preferredSize);
    add(scroller);
}
 
開發者ID:richardwilkes,項目名稱:gcs,代碼行數:51,代碼來源:ReferenceLookupPreferences.java


注:本文中的com.trollworks.toolkit.ui.widget.BandedPanel類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。