本文整理汇总了Java中javax.swing.JTabbedPane.setTabPlacement方法的典型用法代码示例。如果您正苦于以下问题:Java JTabbedPane.setTabPlacement方法的具体用法?Java JTabbedPane.setTabPlacement怎么用?Java JTabbedPane.setTabPlacement使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类javax.swing.JTabbedPane
的用法示例。
在下文中一共展示了JTabbedPane.setTabPlacement方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: createNewTestDataTab
import javax.swing.JTabbedPane; //导入方法依赖的package包/类
private JTabbedPane createNewTestDataTab(TestData sTestData) {
JTabbedPane testdataTab = new JTabbedPane();
testdataTab.setTabLayoutPolicy(JTabbedPane.SCROLL_TAB_LAYOUT);
testdataTab.setTabPlacement(JTabbedPane.BOTTOM);
addToTab(testdataTab, sTestData.getGlobalData(), true);
for (AbstractDataModel std : sTestData.getTestDataList()) {
addToTab(testdataTab, std, false);
}
JLabel label = new JLabel("Click + to Add New TestData");
testdataTab.addTab("", ADD_NEW_TAB_ICON, label);
label.setHorizontalAlignment(JLabel.CENTER);
TabTitleEditListener l = new TabTitleEditListener(testdataTab, onTestDataRenameAction(), 0);
l.setOnMiddleClickAction(onCloseAction());
testdataTab.addChangeListener(l);
testdataTab.addMouseListener(l);
testdataTab.addChangeListener(this);
testdataTab.addMouseListener(onAddNewTDTab());
testdataTab.setComponentPopupMenu(testDataTabPopup);
return testdataTab;
}
示例2: SyncSinkFrame
import javax.swing.JTabbedPane; //导入方法依赖的package包/类
public SyncSinkFrame(){
super("SyncSink");
logTextField = new JTextArea();
logTextField.setEditable(false);
DefaultCaret caret = (DefaultCaret)logTextField.getCaret();
caret.setUpdatePolicy(DefaultCaret.ALWAYS_UPDATE);
StringBuilder sb = new StringBuilder();
sb.append("----------------------------------------\n");
sb.append("Configuration currently in use: \n");
for(Key key : Key.values()){
sb.append("\t");
sb.append(key.name());
sb.append("=");
sb.append(Config.get(key));
sb.append("\n");
}
sb.append("----------------------------------------\n");
logTextField.setText(sb.toString());
this.setLayout(new BorderLayout());
this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
cs = new CoordinateSystem(AxisUnit.OCCURENCES, 0, 1000);
linkedPanel = new LinkedPanel(cs);
linkedPanel.addLayer(new BackgroundLayer(cs));
linkedPanel.addLayer(new ZoomMouseListenerLayer());
linkedPanel.addLayer(new DragMouseListenerLayer(cs));
linkedPanel.addLayer(new BackgroundLayer(cs));
linkedPanel.addLayer(new TimeAxisLayer(cs));
linkedPanel.addLayer(new SelectionLayer(cs));
linkedPanel.getViewPort().addViewPortChangedListener(this);
matches = new ArrayList<NFFTSyncMatch>();
this.streamLayers = new ArrayList<StreamLayer>();
this.streamFiles = new ArrayList<File>();
JTabbedPane tabbedPane = new JTabbedPane();
tabbedPane.addTab("Timebox plot", null, linkedPanel,"Timebox plots");
tabbedPane.setMnemonicAt(0, KeyEvent.VK_1);
tabbedPane.addTab("Messages", null, new JScrollPane(logTextField),"Logs messages");
tabbedPane.setMnemonicAt(1, KeyEvent.VK_2);
tabbedPane.setTabPlacement(JTabbedPane.BOTTOM);
tabbedPane.setBorder(new EmptyBorder(0,0,0,0));
this.add(tabbedPane,BorderLayout.CENTER);
this.add(createStatusBarPanel(),BorderLayout.SOUTH);
new FileDrop(null, tabbedPane, /*dragBorder,*/ new FileDrop.Listener(){
public void filesDropped( final File[] files ){
new Thread(new Runnable(){
@Override
public void run() {
for( int i = 0; i < files.length; i++) {
final File fileToAdd = files[i];
logMessage("Adding " + fileToAdd.getPath() + "...");
openFile(fileToAdd,streamFiles.size());
logMessage("Added " + fileToAdd.getPath() + ".");
}
}},"File adding thread").start();
}
});
}
示例3: PackageBrowser
import javax.swing.JTabbedPane; //导入方法依赖的package包/类
public PackageBrowser(JFrame frame, String title, boolean modal) {
super(MainFrame.mainFrame,title, modal);
addWindowListener(WindowDisposer.getDisposer());
addKeyListener(WindowDisposer.getDisposer());
ActionEventHandler actionEventH = new ActionEventHandler();
LibComboActionEvnetHandler libComboHandler = new LibComboActionEvnetHandler();
PackageListSelectionEventHandler packageListSelectionEventH = new PackageListSelectionEventHandler();
ClassListSelectionEventHandler classListSelectionEventH = new ClassListSelectionEventHandler();
TreeExpansionEventHandler treeExpansionEventH = new TreeExpansionEventHandler();
tabbedPane = new JTabbedPane();
//List view tab
libListRenderer = new LibComboCellRenderer();
packageListRenderer = new PackageListCellRenderer();
classListRenderer = new ClassListCellRenderer();
libraryCombo = new JComboBox();
libraryCombo.setRenderer(libListRenderer);
libraryCombo.addActionListener(libComboHandler);
packageList = new JList();
packageList.setCellRenderer(packageListRenderer);
packageList.addListSelectionListener(packageListSelectionEventH);
classList = new JList();
classList.setCellRenderer(classListRenderer);
classList.addListSelectionListener(classListSelectionEventH);
listViewTab = new ListViewPanel(libraryCombo, packageList, classList);
tabbedPane.addTab("ListView", listViewTab);
tabbedPane.setTabPlacement(SwingConstants.TOP);
tabbedPane.setSelectedIndex(0);
tree = new JTree();
tree.putClientProperty("JTree.lineStyle", "Angled");
tree.addTreeExpansionListener(treeExpansionEventH);
treeRenderer = new PackageBrowserTreeCellRenderer();
tree.setCellRenderer(treeRenderer);
//Tree view tab
treeViewTab = new TreeViewPanel(tree);
treeViewTab.setPackageBrowser(this);
tabbedPane.addTab("TreeView", treeViewTab);
//buttons panel
selectBtn = new JButton("Select");
selectBtn.setActionCommand("Select");
selectBtn.addActionListener(actionEventH);
selectBtn.setEnabled(true);
cancelBtn = new JButton("Close");
cancelBtn.setActionCommand("Close");
cancelBtn.addActionListener(actionEventH);
btnP = new JPanel();
FlowLayout btnL = new FlowLayout();
btnP.setLayout(btnL);
btnP.add(selectBtn);
btnP.add(cancelBtn);
setFirstData();
getContentPane().add(tabbedPane, BorderLayout.CENTER);
getContentPane().add(btnP, BorderLayout.SOUTH);
getContentPane().add(new JPanel(),BorderLayout.WEST);
getContentPane().add(new JPanel(),BorderLayout.EAST);
setSize(250,480);
setLocation(150, 150);
this.setResizable(false);
}