Im using a jTabbedpane for my application. In normal window size, its like this.
But when its maximized, Its like this. (Tabs do not change their size).
I want to adjust tabs as to distribute evenly in any window size.
Thank You.
Im using a jTabbedpane for my application. In normal window size, its like this.
But when its maximized, Its like this. (Tabs do not change their size).
I want to adjust tabs as to distribute evenly in any window size.
Thank You.
I found a code.
int wid = (tp_main.getSize().width)/6;
for(int i=0; i<6;i++){
String name= tp_main.getTitleAt(i);
tp_main.setTitleAt(i,"<html><div style=\"width: "+new Integer(wid)+"px\">"+new String(name)+"</div></html>");
}
tp_main is the jTabbedpane
int wid = (tp_main.getSize().width)/6;
here devided by 6 as i have 6 tabs.
The only thing I can think of is when the window size changes, adjust the padding of the tabs dynamically. Here is a good starting point.
this is worked for me. change your tab sizes went to remove this space
JLabel lab = new JLabel();
lab.setPreferredSize(new Dimension(200, 30));
jTabbedPane1.setTabComponentAt(0, lab); // tab index, jLabel
or try this change to all tab component in same sizes (called in main method)
UIManager.getLookAndFeelDefaults().put("TabbedPane:TabbedPaneTab.contentMargins", new Insets(10, 100, 0, 0));