Results 1 to 9 of 9
Thread: is it possible..?
- 05-11-2012, 08:04 AM #1
Member
- Join Date
- May 2012
- Location
- Yamuna Nagar,Haryana,India
- Posts
- 28
- Rep Power
- 0
- 05-11-2012, 08:50 AM #2
Senior Member
- Join Date
- Jun 2007
- Location
- Bali, Indonesia
- Posts
- 696
- Rep Power
- 6
Re: is it possible..?
If you have a reference to the other forms then it is possible to do it.
Website: Learn Java by Examples
- 05-11-2012, 09:01 AM #3
Member
- Join Date
- May 2012
- Location
- Yamuna Nagar,Haryana,India
- Posts
- 28
- Rep Power
- 0
Re: is it possible..?
plz tell me how it is possible??
any example code will helps me better..
- 05-11-2012, 02:21 PM #4
Re: is it possible..?
Plenty of example code of all sorts here: Trail: Creating a GUI With JFC/Swing (The Java™ Tutorials)
dbWhy do they call it rush hour when nothing moves? - Robin Williams
- 07-03-2012, 11:37 AM #5
Member
- Join Date
- May 2012
- Location
- Yamuna Nagar,Haryana,India
- Posts
- 28
- Rep Power
- 0
Re: is it possible..?
minizing the form will also minimize the textarea.Java Code:import javax.swing.*; import java.awt.*; import java.awt.event.*; import java.io.*; class text extends JFrame implements KeyListener { JPanel jp; boolean txtChanged=false; JTextArea t; File file; String fname=""; String buf=""; Container c; text() { setUndecorated(true); setVisible(true); setResizable(true); setLocation(550,100); setSize(600,650); setDefaultCloseOperation(EXIT_ON_CLOSE); ImageIcon img=new ImageIcon("icon.png"); setIconImage(img.getImage()); jp=new JPanel(); jp.setLayout(null); t=new JTextArea(); JScrollPane scroll=new JScrollPane(t); t.setBorder(BorderFactory.createLineBorder(Color.black)); t.setFocusable(true); //t.setEditable(false); scroll.setVisible(true); c=getContentPane(); c.setLayout(new BorderLayout()); c.add(scroll, BorderLayout.CENTER); t.addKeyListener(this); try { FileReader fr=new FileReader("intro.txt"); BufferedReader br=new BufferedReader(fr); while ((buf=br.readLine())!=null) { t.append(buf); t.append("\n"); } br.close(); fr.close(); } catch (IOException evt) { System.out.println("Exception: "+evt); } } public void keyPressed(KeyEvent e) { //System.out.println("KP"); } public void keyReleased(KeyEvent e) { //System.out.println("KR"); } public void keyTyped(KeyEvent ke) { txtChanged=true; } } public class array extends JFrame implements ActionListener { JPanel jp; static JButton basic,operation,user_practice,menu; JLabel bg,logo; array() { super("Array-Data Structure Tutorial"); setVisible(true); setResizable(true); setLocation(0,0); setSize(1200,780); setDefaultCloseOperation(EXIT_ON_CLOSE); setExtendedState(JFrame.MAXIMIZED_BOTH); //SetCrossPlatformLookAndFeel(true); //UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName()); //setDefaultLookAndFeelDecorated(true); //UIManager.setLookAndFeel("javax.swing.plaf.metal.MetalLookAndFeel"); ImageIcon img=new ImageIcon("icon.png"); setIconImage(img.getImage()); jp=new JPanel(); jp.setBounds(0,0,500,800); jp.setLayout(null); basic=new JButton("Basic Terminology",new ImageIcon("basic.jpg")); operation=new JButton("Operations",new ImageIcon("operation.jpg")); menu=new JButton("",new ImageIcon("home.png")); user_practice=new JButton("User Practice",new ImageIcon("user.jpg")); bg=new JLabel(new ImageIcon("bg1.jpg")); logo=new JLabel(new ImageIcon("logo.png")); Font f2=new Font("calibri",Font.PLAIN,20); Font f3=new Font("Times New Roman",Font.BOLD,15); basic.setFont(f2); operation.setFont(f2); user_practice.setFont(f2); menu.setFont(f2); add(jp); jp.add(basic); jp.add(operation); jp.add(user_practice); jp.add(menu); jp.add(bg); bg.add(logo); basic.addActionListener(this); operation.addActionListener(this); user_practice.addActionListener(this); menu.addActionListener(this); basic.setBounds(100,160,250,60); operation.setBounds(100,260,250,60); user_practice.setBounds(100,560,250,60); menu.setBounds(55,30,50,50); bg.setBounds(0,0,1300,800); logo.setBounds(700,1,850,80); new text(); } public void actionPerformed(ActionEvent e) { /* if(e.getSource()==menu) { main m1=new main(); this.setVisible(false); } else if(e.getSource()==basic) { basicarray m1=new basicarray(); this.setVisible(false); } else if(e.getSource()==operation) { operations m2=new operations(); this.setVisible(false); } else if(e.getSource()==user_practice) { practicearray m4=new practicearray(); this.setVisible(false); }*/ } public static void main(String str[]) { array x=new array(); } }
plz review this code and plz run this code atleast once to understand what i want to say.....Last edited by kumar.dinesh7; 07-03-2012 at 12:23 PM.
dk
- 07-03-2012, 02:35 PM #6
Re: is it possible..?
Did you read wsaryada's response at #2?
dbWhy do they call it rush hour when nothing moves? - Robin Williams
- 07-03-2012, 03:40 PM #7
Member
- Join Date
- May 2012
- Location
- Yamuna Nagar,Haryana,India
- Posts
- 28
- Rep Power
- 0
Re: is it possible..?
yes i read that but i didn't got a solution.
dk
- 07-03-2012, 08:56 PM #8
Re: is it possible..?
That *is* the solution. If you don't understand what a reference is, and don't know how to pass a parameter to a constructor or method, stop whatever you're doing with GUIs and learn the basics first: Passing Information to a Method or a Constructor (The Java™ Tutorials > Learning the Java Language > Classes and Objects)
dbWhy do they call it rush hour when nothing moves? - Robin Williams
- 07-04-2012, 01:57 PM #9
Member
- Join Date
- May 2012
- Location
- Yamuna Nagar,Haryana,India
- Posts
- 28
- Rep Power
- 0


LinkBack URL
About LinkBacks
Reply With Quote
Bookmarks