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


Java JTabbedPane類代碼示例

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


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

示例1: JTabbedPaneTest

import charvax.swing.JTabbedPane; //導入依賴的package包/類
JTabbedPaneTest(JFrame owner_) {
    super(owner_, "JTabbedPane Test");

    Container contentPane = getContentPane();

    JPanel toppan = new JPanel();
    toppan.setBorder(new EmptyBorder(1, 1, 1, 1));
    toppan.add(new JLabel(
            "Press the F5, F6 and F7 keys to switch between panes"));

    JPanel centerpan = new JPanel();
    centerpan.setLayout(new FlowLayout(FlowLayout.LEFT, 2, 1));

    _tabpane = new JTabbedPane();
    _tabpane.addTab("General (F5)", 'g', new GeneralPane());
    _tabpane.addTab("Device Manager (F6)", 'd', new DevicePane());
    _tabpane.addTab("Performance (F7)", 'p', new PerformancePane());
    addKeyListener(this);
    centerpan.add(_tabpane);

    _okButton = new JButton("OK");
    _okButton.setMnemonic('o');
    _okButton.addActionListener(this);

    contentPane.add(toppan, BorderLayout.NORTH);
    contentPane.add(centerpan, BorderLayout.CENTER);
    contentPane.add(_okButton, BorderLayout.SOUTH);

    pack();
}
 
開發者ID:viktor-podzigun,項目名稱:charva-lanterna,代碼行數:31,代碼來源:JTabbedPaneTest.java

示例2: ConsoleInstaller

import charvax.swing.JTabbedPane; //導入依賴的package包/類
public ConsoleInstaller(PluginRegistry registry, InstallerConfig config) {
	super("DrFTPD Installer");
	_registry = registry;
	_config = config;
	Container contentPane = getContentPane();
	contentPane.setLayout(new BorderLayout());

	JMenuBar menubar = new JMenuBar();
	JMenu jMenuFile = new JMenu("File");
	jMenuFile.setMnemonic('F');

	JMenuItem jMenuItemFileExit = new JMenuItem("Exit", 'x');
	jMenuItemFileExit.addActionListener(this);
	jMenuFile.add(jMenuItemFileExit);

	menubar.add(jMenuFile);
	setJMenuBar(menubar);

	_tabbedPane = new JTabbedPane();
	_configPanel = new ConfigPanel(_config);
	_tabbedPane.addTab("Config", null, _configPanel, "F1");
	_pluginPanel = new PluginPanel(registry,_config);
	_tabbedPane.addTab("Plugins", null, _pluginPanel, "F2");

	JPanel centerPanel = new JPanel();
	BorderLayout centerLayout = new BorderLayout();
	centerPanel.setLayout(centerLayout);
	centerPanel.add(_tabbedPane, BorderLayout.CENTER);

	_exitButton = new JButton();
	_exitButton.setText("Exit");
	_exitButton.addActionListener(new ActionListener() {
		public void actionPerformed(ActionEvent e) {
			terminate();
		}
	});
	_buildButton = new JButton();
	_buildButton.setText("Build");
	_buildButton.addActionListener(this);
	_cleanButton = new JButton();
	_cleanButton.setText("Clean");
	_cleanButton.addActionListener(this);
	_selectAllButton = new JButton();
	_selectAllButton.setText("Select All");
	_selectAllButton.addActionListener(this);

	JPanel southPanel = new JPanel();
	BorderLayout southLayout = new BorderLayout();
	southPanel.setLayout(southLayout);
	JPanel southEastPanel = new JPanel();
	FlowLayout southEastLayout = new FlowLayout();
	southEastLayout.setAlignment(FlowLayout.RIGHT);
	southEastPanel.setLayout(southEastLayout);
	southEastPanel.add(_buildButton);
	southEastPanel.add(_cleanButton);
	southEastPanel.add(_exitButton);
	JPanel southWestPanel = new JPanel();
	FlowLayout southWestLayout = new FlowLayout();
	southWestLayout.setAlignment(FlowLayout.LEFT);
	southWestPanel.setLayout(southWestLayout);
	southWestPanel.add(_selectAllButton);
	southPanel.add(southWestPanel, BorderLayout.WEST);
	southPanel.add(southEastPanel, BorderLayout.EAST);

	contentPane.add(centerPanel, BorderLayout.CENTER);
	contentPane.add(southPanel, BorderLayout.SOUTH);

	addKeyListener(this);

	setLocation(0, 0);
	setSize(toolkit.getScreenColumns(),toolkit.getScreenRows());
	validate();
}
 
開發者ID:drftpd-ng,項目名稱:drftpd3,代碼行數:74,代碼來源:ConsoleInstaller.java


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