本文整理汇总了Java中javax.swing.JTabbedPane.getTitleAt方法的典型用法代码示例。如果您正苦于以下问题:Java JTabbedPane.getTitleAt方法的具体用法?Java JTabbedPane.getTitleAt怎么用?Java JTabbedPane.getTitleAt使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类javax.swing.JTabbedPane
的用法示例。
在下文中一共展示了JTabbedPane.getTitleAt方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getProjectWindowTabSelected
import javax.swing.JTabbedPane; //导入方法依赖的package包/类
/**
* Gets the currently selected tab as instance of ProjectWindowTab.
*
* @return the tab selected
*/
private ProjectWindowTab getProjectWindowTabSelected() {
ProjectWindowTab tabSelected = null;
int selIndex = this.projectViewRightTabs.getSelectedIndex();
if (selIndex > -1) {
String tabTitle = this.projectViewRightTabs.getTitleAt(selIndex);
tabSelected = getProjectWindowTab(tabTitle);
if (tabSelected != null) {
JTabbedPane subPane = tabSelected.getCompForChildComp();
if (subPane != null) {
int selSubIndex = subPane.getSelectedIndex();
if (selSubIndex != -1) {
tabTitle = subPane.getTitleAt(selSubIndex);
tabSelected = getProjectWindowTab(tabTitle);
}
}
}
}
return tabSelected;
}
示例2: deleteTestData
import javax.swing.JTabbedPane; //导入方法依赖的package包/类
private void deleteTestData(Object source) {
JTabbedPane tab = (JTabbedPane) source;
TestDataTablePanel panel = getSelectedData();
if (!panel.isGlobalData) {
int index = tab.getSelectedIndex();
String name = tab.getTitleAt(index);
int option = JOptionPane.showConfirmDialog(null, "Are you sure want to delete the TestData [" + name + "]", "Delete TestData", JOptionPane.YES_NO_OPTION);
if (option == JOptionPane.YES_OPTION) {
Boolean flag = testDesign.getProject().getTestData()
.getTestDataFor(envTab.getTitleAt(envTab.getSelectedIndex()))
.deleteTestData(name);
if (flag) {
tab.setSelectedIndex(index - 1);
tab.removeTabAt(index);
} else {
Notification.show("Couldn't Delete Testdata - '" + name + "'");
}
}
}
}
示例3: getItemText
import javax.swing.JTabbedPane; //导入方法依赖的package包/类
protected static String getItemText(JTabbedPane tabbedPane, int index) {
String titleAt = tabbedPane.getTitleAt(index);
if (titleAt == null || "".equals(titleAt)) {
return getTabNameFromIcon(tabbedPane, index);
}
return titleAt;
}
示例4: TabComponent
import javax.swing.JTabbedPane; //导入方法依赖的package包/类
/**
* Constructor for TabComponent class.
*
* @param pane
* {@link JTabbedPane} parent component.
* @param observer
* Main JNotepadPP frame.
* @param lp
* Localization provider.
*/
public TabComponent(JTabbedPane pane, JNotepadPP observer,
ILocalizationProvider lp) {
super(new FlowLayout(FlowLayout.LEFT, 0, 0));
this.lp = lp;
this.observer = observer;
setOpaque(false);
JLabel label = new JLabel() {
private static final long serialVersionUID = 1L;
public String getText() {
int i = pane.indexOfTabComponent(TabComponent.this);
if (i != -1) {
this.revalidate();
return pane.getTitleAt(i);
}
return "";
}
};
ImageIcon image = new ImageIcon(this.getClass().getResource(
"res/green.png"));
picLabel = new JLabel(image);
add(picLabel);
add(label);
picLabel.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 5));
label.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 5));
closeButton = new CloseTabButton(this);
add(closeButton);
setBorder(BorderFactory.createEmptyBorder(2, 0, 0, 0));
}
示例5: ButtonTabComponent
import javax.swing.JTabbedPane; //导入方法依赖的package包/类
public ButtonTabComponent(final JTabbedPane pane) {
//unset default FlowLayout' gaps
super(new FlowLayout(FlowLayout.LEFT, 0, 0));
if (pane == null) {
throw new NullPointerException("TabbedPane is null");
}
this.pane = pane;
setOpaque(false);
//make JLabel read titles from JTabbedPane
JLabel label = new JLabel() {
public String getText() {
int i = pane.indexOfTabComponent(ButtonTabComponent.this);
if (i != -1) {
return pane.getTitleAt(i);
}
return null;
}
};
add(label);
//add more space between the label and the button
label.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 5));
//tab button
JButton button = new TabButton();
add(button);
//add more space to the top of the component
setBorder(BorderFactory.createEmptyBorder(2, 0, 0, 0));
}