Hello everybody,
My english is not very well but i will try to make the best of it :)
I'm working about a Java Application for a school project. I will make a presentation with buttons to switch to the next screen. First the can select the language between Netherlands or English (to click on the flag) and then follows the presentation in the language the have chosen. Till now i have made the following code:
And:Code:import java.applet.*;
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
public class EventApplicatie2 extends JFrame {
private JPanel paneel;
public EventApplicatie2() {
paneel = new WelkomstPaneel();
setContentPane( paneel );
}
public static void main( String args[] ) {
JFrame frame = new EventApplicatie2();
frame.setDefaultCloseOperation( JFrame.EXIT_ON_CLOSE );
frame.setSize( 400, 200 );
frame.setLocation( 200, 200 );
frame.setSize( 450, 400 );
frame.setTitle( "EventApplicatie" );
frame.setVisible( true );
}
}
Only this code is not enough and i don't how to make the rest of the program.Code:import java.applet.*;
import java.awt.*;
import javax.swing.*;
import java.awt.event.*;
public class WelkomstPaneel extends JPanel {
private JLabel Label, Label2;
private JButton knop, knop1;
private boolean JPG;
private ImageIcon JPG1, JPG2;
public WelkomstPaneel() {
JPG1 = new ImageIcon( "EngelandVlag.JPG" );
JPG2 = new ImageIcon( "NederlandseVlag.JPG" );
setLayout( null );
Label = new JLabel( "Hartelijk welkom bij Nemo / Welcome to Nemo");
Label.setBounds( 80, 50, 500, 20);
Label2 = new JLabel( "Selecteer uw taal / Choose your laguage");
Label2.setBounds( 80, 70, 500, 20);
knop = new JButton( "Ga verder" );
knop.addActionListener( new KnopHandler() );
knop.setBounds( 100, 80, 120, 20 );
knop1 = new JButton( "Go" );
knop.setBounds( 100, 200, 120, 20 );
add( Label );
add( Label2 );
add( knop );
add( knop1 );
}
public void paintComponent( Graphics g ){
super.paintComponent( g );
JPG2.paintIcon( this, g, 100, 100 );
JPG1.paintIcon( this, g, 230, 100 );
}
class KnopHandler implements ActionListener {
public void actionPerformed( ActionEvent e ){
if( e.getSource() == knop )
Label.setText( "Selecteer uw taal" );
if( e.getSource() == knop1 )
Label.setText( "Choose youre language" );
}
}
}
This is my result till now:
http://img511.imageshack.us/img511/5379/resultkk7.jpg
