Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- private static final long serialVersionUID = 1L;
- private String name;
- private final int width = 150, height = 50;
- public ColoredTabs(String paneName, int tabPlacement, String[] names, Color[] colors, JComponent[] components){
- super(tabPlacement);
- this.name = paneName;
- if(names.length != components.length || names.length != colors.length || components.length != colors.length){
- throw new IllegalArgumentException("The arguments for COMPONENTS, COLORS, and NAMES do not match up for '"+this.name+"'...");
- }
- setFont(Resources.getFont());
- setBackground(Color.YELLOW);
- for(int i = 0; i < names.length; i++){
- addTab(names[i], components[i]);
- setBackgroundAt(i, colors[i]);
- setIconAt(i, new ImageIcon(new BufferedImage(width, height, BufferedImage.TYPE_INT_ARGB)));
- }
- }
- //Create new label to be used as a tab name
- JLabel tabLabel = new JLabel("Tab", JLabel.CENTER);
- //add new label at set location
- jTabbedPane.setTabComponentAt(0, tabLabel);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement