Advertisement
Guest User

Untitled

a guest
Apr 16th, 2014
50
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.99 KB | None | 0 0
  1. private static final long serialVersionUID = 1L;
  2. private String name;
  3. private final int width = 150, height = 50;
  4. public ColoredTabs(String paneName, int tabPlacement, String[] names, Color[] colors, JComponent[] components){
  5. super(tabPlacement);
  6. this.name = paneName;
  7. if(names.length != components.length || names.length != colors.length || components.length != colors.length){
  8. throw new IllegalArgumentException("The arguments for COMPONENTS, COLORS, and NAMES do not match up for '"+this.name+"'...");
  9. }
  10. setFont(Resources.getFont());
  11. setBackground(Color.YELLOW);
  12. for(int i = 0; i < names.length; i++){
  13. addTab(names[i], components[i]);
  14. setBackgroundAt(i, colors[i]);
  15. setIconAt(i, new ImageIcon(new BufferedImage(width, height, BufferedImage.TYPE_INT_ARGB)));
  16.  
  17. }
  18. }
  19.  
  20. //Create new label to be used as a tab name
  21. JLabel tabLabel = new JLabel("Tab", JLabel.CENTER);
  22. //add new label at set location
  23. jTabbedPane.setTabComponentAt(0, tabLabel);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement