Buttons: I need a little help
Hello again,
I will be very thankful if someone help me to realize what i want ;
I have written a program and it uses GUI window to show output.
I have also written another program and it uses GUI,too.
What i want is to combine them in a single GUI window.
It will have 2 buttons ; button1 and button2 to change between
the outputs of two programs.
If you can combine those two in a single (two classes of course)
program,i can adapt it to my programs,
thank you so much ;
Program 1
import java.awt.Font;
import java.awt.Color;
import java.awt.Graphics;
import javax.swing.JPanel;
publicclass Sampleextends JPanel
{
publicvoid paintComponent( Graphics g )
{
g.setFont(new Font("Serif", Font.BOLD, 12 ) );
g.setColor(new Color(0,0,0) );
g.drawString("Output1", 50, 50 );
}}
Program 2
import java.awt.Font;
import java.awt.Color;
import java.awt.Graphics;
import javax.swing.JPanel;
publicclass Sampleextends JPanel
{
publicvoid paintComponent( Graphics g )
{
g.setFont(new Font("Serif", Font.BOLD, 12 ) );
g.setColor(new Color(0,0,0) );
g.drawString("Output2", 50, 50 );
}}
also both classes uses this class to execute;
import javax.swing.JFrame;
publicclass Fonts
{
publicstaticvoid main( String args[] )
{
JFrame frame =new JFrame("LandslideVisual by Berkay G鰇tan" );
frame.setDefaultCloseOperation( JFrame.EXIT_ON_CLOSE );
LandslideDetermination fontJPanel =new LandslideDetermination();
frame.add( fontJPanel );
frame.setSize( 500, 500 );
frame.setVisible(true );
}
}

