jtabbedpane

JTabbedPane: change tab size when change tab title

半城伤御伤魂 提交于 2019-12-11 07:45:00
问题 I have a a JTabbedPane myTab within my JFrame. Its first tab has a title of "old title". I want to change the title dynamically, so I use this code to set: myTab.setTitleAt(myTab.getSelectedIndex(), "my full new title"); And somehow my new title is longer than my old one. The problem is, the tab size does not change, and it does not display the new title fully, only "my full n...". And if I click on the tab, suddenly the tab can show full new title. I already tried this code too, to set the

Java JTabbedPane questions

南笙酒味 提交于 2019-12-11 06:13:07
问题 I'm using a JTabbedPane to hold each step in the wizard that I am building. Navigation between steps is doing using the Previous/Next buttons or by selecting a tab. The buttons decrement/increment the JTabbedPane's SelectedIndex. I need to validate each step before proceeding to the next step. Essentially, I'm having difficulty determining which event to use. The StateChange event occurs too late. Which event do I need to observe? Another irritation: when the wizard runs, it seems to save the

JTabbedPane's tab area add a button, it can display, but it can't click

两盒软妹~` 提交于 2019-12-11 05:38:47
问题 I have a JTabbedPane with tabs on the top. To the right of the tabs, I add a button. This button is neither part of JTabbedPane nor is it a tab. Unfortunately, it cannot be clicked. I guess this button is covered by the JTabbedPane , because I moved the button down, it covered by the JTabbedPane . Can anybody give me some suggestion, so that I can click that button? This is the layout; I can't upload image, so I draw it like below: |-------------------------------------| | tab | tab | button

Exception thrown while working with JTabbedPane

孤街浪徒 提交于 2019-12-11 05:27:50
问题 I'm using a JTabbedPane in my application and I listen to its changes with ChangeListener so that I can know which tab is currently selected. So my stateChanged method is; public void stateChanged(ChangeEvent e) { currentPageIndex = jTabbedPane.getSelectedIndex(); } But while I'm adding new tabs to the JTabbedPane it throws an ArrayIndexOutOfBoundsException in the method above, I don't know why. Some suggested for a similar case that this is a bug http://bugs.sun.com/bugdatabase/view_bug.do

How to disable CONTROL+PAGE_UP of a JTabbedPane?

六月ゝ 毕业季﹏ 提交于 2019-12-11 04:02:06
问题 How to disable the default behavior of CONTROL+PAGE_UP and CONTROL+PAGE_DOWN of a JTabbedPane ? 回答1: The following code disables the usual behavior JTabbedPane jTabbedPane = new JTabbedPane(); KeyStroke ctrlTab = KeyStroke.getKeyStroke("ctrl PAGE_DOWN"); KeyStroke ctrlShiftTab = KeyStroke.getKeyStroke("ctrl PAGE_UP"); InputMap inputMap = jTabbedPane.getInputMap(JComponent.WHEN_ANCESTOR_OF_FOCUSED_COMPONENT); inputMap.put(ctrlTab, "none"); inputMap.put(ctrlShiftTab, "none"); Here is an example

How to add a label to the extra space on a tabbed pane

喜夏-厌秋 提交于 2019-12-11 02:54:20
问题 I am trying to add a JLabel to the blank space of a JTabbedPane (to the right of the tabs and above the content panel). I was very close with this SSCCE (using MigLayout ): public static void main(String[] args) { try { UIManager.setLookAndFeel("com.sun.java.swing.plaf.windows.WindowsLookAndFeel"); } catch (ClassNotFoundException | InstantiationException | IllegalAccessException | UnsupportedLookAndFeelException e) { e.printStackTrace(); } JFrame frame = new JFrame(); frame.setLayout(new

Mac JVM rendering JTabbedPane differences between 1.6 and above

泄露秘密 提交于 2019-12-11 02:34:20
问题 This is how JTabbedPane renders in Java 1.6: When using Java 1.7 (or 1.8 EA), see the bottom of the tabs getting clipped: I tried, without any success (or effect) the system properties -Dcom.apple.macos.smallTabs=true and -Dcom.apple.smallTabs=true . Any solution or hack for this is appreciated. 回答1: Running this example, I am unable to reproduce the effect shown on Mac OS X 10.9.2 using Java 7. I suspect you are neglecting to pack() the enclosing Window , but you might compare your code to

How do I go about setting the exact style for tabs in a JTabbedPane?

耗尽温柔 提交于 2019-12-11 02:32:10
问题 I have looked around and I cannot figure out how to do it. Should I use the Synth look & feel? How would I go about doing this? 回答1: In How to Use Tabbed Panes, TabComponentsDemo shows how to put "custom components on tabs." 来源: https://stackoverflow.com/questions/6403393/how-do-i-go-about-setting-the-exact-style-for-tabs-in-a-jtabbedpane

What is causing slow performance in my JTabbedPane-based Swing application?

南楼画角 提交于 2019-12-11 02:20:35
问题 I have a Swing application for creating RPG characters. It has a nested JTabbedPane architecture, so there is a HeroTabsPanel which has HeroPanels and each of those has some more tabs like Stats, Items etc. So the GUI is comprised of the upper tabbed pane for heroes, the lower tabbed pane for current hero tab and an EditViewPanel which displays an EditingView corresponding to each Tab when the tab is selected. Performance has been bad from the start, but when I added the upper level hero-tabs

When does a JTabbedPane component get its size?

守給你的承諾、 提交于 2019-12-11 01:24:35
问题 I need to know the size of a JPanel when I add it to a JTabbedPane to compute other values. If I call the add(Component) method, when does the Component get its size? For example, JTabbedPane tabbedPane = new JTabbedPane(); JPanel panel = new JPanel(); panel.setBackGround(Color.RED); // pretty colors! tabbedPane.add(panel); int newTabIndex = tabbedPane.indexOfComponent(panel); tabbedPane.setSelectedIndex(newTabIndex); Thank you in advance! Edit @mKorbel suggested setting the visibility of the