/**
* @author bjbu
* Created on 10-11-2004
* Gui model fra JDeveloper/JBuilder med selvstændige klasser
*/
import javax.swing.JFrame;
import java.awt.Dimension;
import javax.swing.JButton;
import java.awt.Rectangle;
import javax.swing.JLabel;
import java.awt.event.ActionListener;
import java.awt.event.ActionEvent;
public class Gui_ClassEventHandlereJDev extends JFrame
{
private JButton jButton1 = new JButton();
private JLabel jLabel1 = new JLabel();
public Gui_ClassEventHandlereJDev()
{
try
{
jbInit();
}
catch(Exception e)
{
e.printStackTrace();
}
}
private void jbInit() throws Exception
{
this.setSize(new Dimension(335, 316));
this.getContentPane().setLayout(null);
jButton1.setText("jButton1");
jButton1.setBounds(new Rectangle(130, 60, 90, 65));
jButton1.addActionListener(new Gui_ClassEventHandlereJDev_jButton1_actionAdapter(this));
jLabel1.setText("0");
jLabel1.setBounds(new Rectangle(65, 165, 250, 40));
this.getContentPane().add(jLabel1, null);
this.getContentPane().add(jButton1, null);
}
void jButton1_actionPerformed(ActionEvent e)
{
this.jLabel1.setText(""+(Long.parseLong(this.jLabel1.getText())+1));
}
}
class Gui_ClassEventHandlereJDev_jButton1_actionAdapter implements ActionListener
{
Gui_ClassEventHandlereJDev adaptee;
Gui_ClassEventHandlereJDev_jButton1_actionAdapter(Gui_ClassEventHandlereJDev adaptee)
{
this.adaptee = adaptee;
}
public void actionPerformed(ActionEvent e)
{
adaptee.jButton1_actionPerformed(e);
}
}
/**
* @author bjbu
* Created on 10-11-2004
* Gui model med selvstændige indre klasser
*/
import javax.swing.JFrame;
import java.awt.Dimension;
import javax.swing.JButton;
import java.awt.Rectangle;
import javax.swing.JLabel;
import java.awt.event.ActionListener;
import java.awt.event.ActionEvent;
public class Gui_IndreClassEventHandlere extends JFrame
{
private JButton jButton1 = new JButton();
private JLabel jLabel1 = new JLabel();
public Gui_IndreClassEventHandlere()
{
try
{
jbInit();
}
catch(Exception e)
{
e.printStackTrace();
}
}
private void jbInit() throws Exception
{
this.setSize(new Dimension(335, 316));
this.getContentPane().setLayout(null);
jButton1.setText("jButton1");
jButton1.setBounds(new Rectangle(130, 60, 90, 65));
jButton1.addActionListener(new Gui_IndreClassEventHandlere_jButton1_actionAdapter());
jLabel1.setText("0");
jLabel1.setBounds(new Rectangle(65, 165, 250, 40));
this.getContentPane().add(jLabel1, null);
this.getContentPane().add(jButton1, null);
}
void jButton1_actionPerformed(ActionEvent e)
{
this.jLabel1.setText(""+(Long.parseLong(this.jLabel1.getText())+1));
}
private class Gui_IndreClassEventHandlere_jButton1_actionAdapter implements ActionListener
{
public void actionPerformed(ActionEvent e)
{
jButton1_actionPerformed(e); // kode kunne også placeres her
}
}
}
/**
* @author bjbu
* Created on 10-11-2004
* Gui model fra JDeveloper/Jbuilder? med annonym indre klasser
*/
import javax.swing.JFrame;
import javax.swing.JButton;
import java.awt.BorderLayout;
import java.awt.Rectangle;
import javax.swing.JLabel;
import java.awt.event.ActionListener;
import java.awt.event.ActionEvent;
import java.awt.Dimension;
public class Gui_IndreAnonymEventHandlereJDev extends JFrame
{
private JButton jButton1 = new JButton();
private JLabel jLabel1 = new JLabel();
public Gui_IndreAnonymEventHandlereJDev()
{
try
{
jbInit();
}
catch(Exception e)
{
e.printStackTrace();
}
}
private void jbInit() throws Exception
{
this.setSize(new Dimension(335, 316));
this.getContentPane().setLayout(null);
jButton1.setText("jButton1");
jButton1.setBounds(new Rectangle(130, 60, 90, 65));
jButton1.addActionListener(new ActionListener()
{
public void actionPerformed(ActionEvent e)
{
jButton1_actionPerformed(e);
}
});
jLabel1.setText("0");
jLabel1.setBounds(new Rectangle(65, 165, 250, 40));
this.getContentPane().add(jLabel1, null);
this.getContentPane().add(jButton1, BorderLayout.CENTER);
}
private void jButton1_actionPerformed(ActionEvent e)
{
this.jLabel1.setText(""+(Long.parseLong(this.jLabel1.getText())+1));
}
}
/**
* @author bjbu
* Created on 10-11-2004
* Gui model med anonyme klasser eclipse model
*/
import javax.swing.JButton;
import javax.swing.JLabel;
import javax.swing.JFrame;
import java.awt.Dimension;
import javax.swing.JButton;
import java.awt.Rectangle;
import javax.swing.JLabel;
import java.awt.event.ActionListener;
import java.awt.event.ActionEvent;
public class GuiIndreAnonymEventHandlerEclipse extends JFrame {
private javax.swing.JPanel jContentPane = null;
private JButton JButton1 = null;
private JLabel jLabel1 = null;
/**
* This method initializes JButton
*
* @return javax.swing.JButton
*/
private JButton getJButton1() {
if (JButton1 == null) {
JButton1 = new JButton();
JButton1.setBounds(96, 37, 95, 34);
JButton1.setText("JButton1");
JButton1.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent e) {
JButton1_actionPerformed(e);
}
});
}
return JButton1;
}
public static void main(String[] args) {
}
/**
* This is the default constructor
*/
public GuiIndreAnonymEventHandlerEclipse() {
super();
initialize();
}
/**
* This method initializes this
*
* @return void
*/
private void initialize() {
this.setSize(300,200);
this.setContentPane(getJContentPane());
}
/**
* This method initializes jContentPane
*
* @return javax.swing.JPanel
*/
private javax.swing.JPanel getJContentPane() {
if(jContentPane == null) {
jLabel1 = new JLabel();
jContentPane = new javax.swing.JPanel();
jContentPane.setLayout(null);
jLabel1.setBounds(77, 80, 119, 24);
jLabel1.setText("0");
jContentPane.add(jLabel1, null);
jContentPane.add(getJButton1(), null);
}
return jContentPane;
}
public void JButton1_actionPerformed(ActionEvent e)
{
this.jLabel1.setText(""+(Long.parseLong(this.jLabel1.getText())+1));
}
}