Author: jerome Date: 2008-08-15 14:09:04 +0200 (Fri, 15 Aug 2008) New Revision: 1500
Modified: software_suite_v2/software/tools/chatterTux/trunk/Chatter_tux/src/ChatterTux.java software_suite_v2/software/tools/chatterTux/trunk/Chatter_tux/src/ct_main.java Log: * Simple action chooser. Modified: software_suite_v2/software/tools/chatterTux/trunk/Chatter_tux/src/ChatterTux.java =================================================================== --- software_suite_v2/software/tools/chatterTux/trunk/Chatter_tux/src/ChatterTux.java 2008-08-15 11:38:22 UTC (rev 1499) +++ software_suite_v2/software/tools/chatterTux/trunk/Chatter_tux/src/ChatterTux.java 2008-08-15 12:09:04 UTC (rev 1500) @@ -1,15 +1,15 @@ -/* This file is part of "TuxDroid Control Center". +/* This file is part of "TuxDroid Chatter Tux tool". * Copyright 2008, kysoh * Author : Conan Jerome * eMail : [EMAIL PROTECTED] * Site : http://www.kysoh.com/ * - * "TuxDroid Control Center" is free software; you can redistribute it and/or + * "TuxDroid Chatter Tux tool" is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * - * "TuxDroid Control Center" is distributed in the hope that it will be useful, + * "TuxDroid Chatter Tux tool" is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * General Public License for more details. @@ -20,7 +20,133 @@ * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ +import java.awt.Dimension; +import java.awt.Font; +import java.awt.Point; +import javax.swing.ButtonGroup; +import javax.swing.JButton; +import javax.swing.JFrame; +import javax.swing.JLabel; +import javax.swing.JPanel; +import javax.swing.JRadioButton; + public class ChatterTux { + /** Chatter Tux component **/ + private JFrame frame; + private JPanel jContentPane; + private JRadioButton configure; + private JRadioButton startServer; + private ButtonGroup group; + private JLabel Message = new JLabel("Select Chatter Tux action"); + private JButton ok; + private JButton cancel; + + private byte action = -1; + private static final byte CONFIGURE = 0; + private static final byte START = 1; + + /** + * Class constructor. + */ + public ChatterTux(){ + + frame = this.getFrame(); + frame.add(this.getContentPane()); + frame.setResizable(false); + + frame.pack(); + } + + + /** + * @return application frame. + */ + public JFrame getFrame(){ + if(this.frame == null){ + frame = new JFrame("Chatter Tux"); + frame.setSize(new Dimension(250, 180)); + frame.setPreferredSize(frame.getSize()); + + frame.setVisible(true); + } + return this.frame; + } + + /** + * @return contentPane. + */ + public JPanel getContentPane(){ + if(this.jContentPane == null){ + jContentPane = new JPanel(); + jContentPane.setLayout(null); + jContentPane.add(this.getConfigure()); + jContentPane.add(this.getStartServer()); + this.Message.setSize(new Dimension(200, 20)); + this.Message.setLocation(new Point(10, 4)); + this.Message.setFont(new Font("verdana", Font.BOLD, 11)); + jContentPane.add(this.Message); + jContentPane.add(this.getOkButton()); + jContentPane.add(this.getCancelButton()); + this.group = new ButtonGroup(); + this.group.add(this.configure); + this.group.add(this.startServer); + } + return jContentPane; + } + + + public JRadioButton getConfigure(){ + if(this.configure == null){ + configure = new JRadioButton("Configure"); + configure.setSize(new Dimension(100,25)); + configure.setLocation(new Point(20, 30)); + } + return this.configure; + } + + public JRadioButton getStartServer(){ + if(this.startServer == null){ + this.startServer = new JRadioButton("Start Chatter"); + this.startServer.setSize(new Dimension(100, 25)); + this.startServer.setLocation(new Point(20, 55)); + } + return this.startServer; + } + + + public JButton getOkButton(){ + if(this.ok == null){ + this.ok = new JButton("Ok"); + this.ok.setSize(new Dimension(80,24)); + this.ok.setLocation(new Point(24, 90)); + this.ok.addMouseListener(new java.awt.event.MouseAdapter(){ + public void mouseClicked(java.awt.event.MouseEvent event){ + if(group.getSelection().equals(configure.getModel())){ + action = ChatterTux.CONFIGURE; + }else{ + action = ChatterTux.START; + } + } + }); + } + return this.ok; + } + + + public JButton getCancelButton(){ + if(this.cancel == null){ + this.cancel = new JButton("Cancel"); + cancel.setSize(new Dimension(80, 24)); + cancel.setLocation(new Point(110, 90)); + cancel.addMouseListener(new java.awt.event.MouseAdapter(){ + public void mouseClicked(java.awt.event.MouseEvent event){ + System.exit(0); + } + }); + } + return this.cancel; + } + } Modified: software_suite_v2/software/tools/chatterTux/trunk/Chatter_tux/src/ct_main.java =================================================================== --- software_suite_v2/software/tools/chatterTux/trunk/Chatter_tux/src/ct_main.java 2008-08-15 11:38:22 UTC (rev 1499) +++ software_suite_v2/software/tools/chatterTux/trunk/Chatter_tux/src/ct_main.java 2008-08-15 12:09:04 UTC (rev 1500) @@ -1,15 +1,15 @@ -/* This file is part of "TuxDroid Control Center". +/* This file is part of "TuxDroid Chatter Tux tool". * Copyright 2008, kysoh * Author : Conan Jerome * eMail : [EMAIL PROTECTED] * Site : http://www.kysoh.com/ * - * "TuxDroid Control Center" is free software; you can redistribute it and/or + * "TuxDroid Chatter Tux tool" is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * - * "TuxDroid Control Center" is distributed in the hope that it will be useful, + * "TuxDroid Chatter Tux tool" is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * General Public License for more details. @@ -23,7 +23,7 @@ public class ct_main { public static void main(String[] args){ - + new ChatterTux(); } } ------------------------------------------------------------------------- This SF.Net email is sponsored by the Moblin Your Move Developer's challenge Build the coolest Linux based applications with Moblin SDK & win great prizes Grand prize is a trip for two to an Open Source event anywhere in the world http://moblin-contest.org/redirect.php?banner_id=100&url=/ _______________________________________________ Tux-droid-svn mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/tux-droid-svn
