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

... 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);
  }
}

you can just use the add sign

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.