add text area to the panel
this is just a normal text area.that i am going to add with JPanel or JFrame...Source code below
package myPackage;
import java.awt.Dimension;
import javax.swing.JFrame;
import javax.swing.JPanel;
import javax.swing.JTextArea;
public class myClass {
public static void main(String[]args){
JFrame frame = new JFrame();
JPanel panel = new JPanel();
/*create JTextArea Object */
JTextArea area = new JTextArea();
frame.setSize(400,400);
frame.setDefaultCloseOperation
(JFrame.EXIT_ON_CLOSE);
frame.setVisible(true);
frame.setTitle("java beginner");
frame.add(panel);
/*give size first*/
area.setPreferredSize(new Dimension(100,30));
/*add area to the
* panel
*/
panel.add(area);
}
}
And if you run this.So it would look like this

Stylish area code
now if you wanna make you area a little cooler than this so copy this code and paste it to your project
/*setBackground color*/ area.setBackground(Color.BLACK); /*setText color of area*/ area.setForeground(Color.white); /*setFont of area*/ Font font = new Font("arial",Font.BOLD,22); area.setFont(font);
If right now if you have any problem just contact me i have given the contact form in each of my page.So just click on that and leave me a comment or just message me and trust me.i'd love help you out from every difficulties you have..
No comments:
Post a Comment