0

first i tried with system.out..

then i tried this:

import javax.swing.*;
import java.awt.*;
public class Ejer1 {
	
	public static void main(String [] args){
		JTextArea graphs = new JTextArea();
	String [] graph1 = {"*********"};
	String [] graph2 = {"%s\n%s\n%s\n%s\n%s\n", "*       *","*       *","*       *",
			"*       *", "*       *","*", "*       *","*     *","*        *","*        *","*         *","*        *"};
	String [] graph3 = {"*********"};
		
		
		JFrame frame = new JFrame();
		frame.setVisible(true);
		frame.setSize(300,300);
		frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
 
		JLabel label = new JLabel();
		JPanel panel = new JPanel();
		frame.add(panel);
		frame.add(label);
		frame.add(graphs);
 
	
 
	}
	}

Doesnt work either.. can anyone point to me how would i display those stars that form a square i would be so grateful please and thanks

3
Contributors
2
Replies
3
Views
6 Years
Discussion Span
Last Post by Xeno999
0

... Reply to your own thread instead of create a new one... Try the code below... Not sure if it is working because I didn't test.

import javax.swing.*;
import java.awt.*;
public class Ejer1 {
  public static void main(String [] args){
    JTextArea jt = new JTextArea();
    jt.setText("Set it this way");
    JFrame frame = new JFrame();
 
    JLabel label = new JLabel();
    JPanel panel = new JPanel();
    frame.add(panel);
    frame.add(label);
    frame.add(jt);

    frame.setVisible(true);
    frame.setSize(300,300);
    frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
  }
}

Edited by Taywin: n/a

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.