/* * To change this template, choose Tools | Templates * and open the template in the editor. */ package eric.GUI.window; import eric.GUI.pipe_tools; import eric.GUI.themes; import eric.JZirkelCanvas; import java.awt.Color; import java.awt.Component; import java.awt.Graphics; import java.awt.event.FocusAdapter; import java.awt.event.FocusEvent; import java.awt.event.KeyAdapter; import java.awt.event.KeyEvent; import java.awt.event.MouseAdapter; import java.awt.event.MouseEvent; import javax.swing.JLabel; import javax.swing.JTextField; import javax.swing.SwingConstants; import javax.swing.SwingUtilities; /** * * @author erichake */ public class tab_btn_label extends JLabel { private static final int fileMarginLeft=20, workbookMarginLeft=5; private static int marginLeft=fileMarginLeft, marginTop=2, marginRight=15; private MouseAdapter ma=null; private boolean over=false; private String label=""; public void init() { int w=tab_main_panel.visibleWidth((tab_btn) getParent()); setBounds(marginLeft, marginTop, w-marginLeft-marginRight, getParent().getSize().height-2*marginTop); String lbl=(tab_main_panel.rightcut((tab_btn) getParent()))?label+"...":label; setText(lbl); } public void setLabelText(String s) { super.setText(label=s); } public String getLabelText() { return label; } public tab_btn_label(String lbl) { super(lbl); label=lbl; setFont(themes.TabFont); setVerticalTextPosition(SwingConstants.TOP); setBorder(null); setOpaque(false); } public void setChanged(boolean b) { Color col=Color.black; if (b) { col=themes.TabChangedColor; } marginLeft=(JZirkelCanvas.isWorkBook())?workbookMarginLeft:fileMarginLeft; setForeground(col); init(); repaint(); } public void implementMouseAdapter() { tab_btn btn=(tab_btn) getParent(); tab_main_panel mp=tab_main_panel.getme(); tab_control_panel tcp=tab_control_panel.getme(); final ContentPane pane=pipe_tools.getContent(); ma=new MouseAdapter() { @Override public void mousePressed(MouseEvent e) { pane.requestFocus(); } }; for (int i=0; i