/* * McbSettingsTitle.java * * Created on May 12, 2006, 11:03 AM */ package Current.popups.Settings; import java.awt.*; import java.awt.event.*; import org.pat.graphics.boxed.ListenString; import Current.*; import Current.manage.*; import Current.gui.*; /** * * @author pat */ public class Title extends DBCanvas implements MouseListener { Manager M; SettingsPopup MSP; ListenString[] LS; int padding=4; /** Creates a new instance of McbSettingsTitle */ public Title(Manager M, SettingsPopup MSP) { this.M=M; this.MSP=MSP; setFont(new Font("sanserif", Font.PLAIN, 12)); setBackground(new Color(0,0,200)); LS=new ListenString[5]; LS[0]=new ListenString("Settings", this); LS[0].showBorder=false; LS[0].setColors(Color.white,this.getBackground()); LS[1]=new ListenString("?", this); LS[1].setColors(Color.white,this.getBackground()); LS[2]=new ListenString("menu", this); LS[3]=new ListenString("load", this); LS[4]=new ListenString("save", this); double x=padding, y=padding; LS[0].setLeft(x); LS[0].setTop(y); LS[1].setTop(y); y=LS[0].getBottom()+padding; for (int i=2; i<5; i++) { LS[i].setLeft(x); LS[i].setTop(y); x=padding+LS[i].getRight(); LS[i].setColors(Color.blue,Color.white); } this.setSize(200, (int)(padding+LS[4].getBottom())); this.addMouseListener(this); } public void paint(Graphics gfx) { Graphics2D g=(Graphics2D) gfx; g.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON); LS[1].setRight(this.getWidth()-padding); LS[0].render(g); LS[1].render(g); LS[2].render(g); LS[3].render(g); if (M.canWrite()) LS[4].render(g); } public void mouseClicked(MouseEvent e) { if (LS[1].contains(e.getX(),e.getY())) { M.mcbSend(new HelpDocument("McbSettings.html")); } if (LS[2].contains(e.getX(),e.getY())) { MSP.setCenter(M.settingsManager.getList(MSP)); } if (LS[3].contains(e.getX(),e.getY())) { MSP.setCenter(new Load(M)); } if (LS[4].contains(e.getX(),e.getY())) { MSP.setCenter(new Save(M)); } } public void mouseEntered(MouseEvent e) { } public void mouseExited(MouseEvent e) { } public void mousePressed(MouseEvent e) { } public void mouseReleased(MouseEvent e) { } }