Java GUI

Java GUI

View Answers

December 12, 2008 at 6:21 AM

Hi friend,

Code to help in solving the problem :

import java.awt.GridLayout;
import java.awt.event.*;

import javax.swing.*;

public class JLabelExample extends JPanel {

JLabel jlbLabel1, jlbLabel2, jlbLabel3;
public JLabelExample() {
ImageIcon icon = new ImageIcon("output.gif","My Website");

setLayout(new GridLayout(3, 1));

jlbLabel1 = new JLabel("Image with Text", icon, JLabel.CENTER);

jlbLabel1.setVerticalTextPosition(JLabel.BOTTOM);
jlbLabel1.setHorizontalTextPosition(JLabel.CENTER);
jlbLabel2 = new JLabel("Text Only Label");
jlbLabel3 = new JLabel(icon);

add(jlbLabel1);
add(jlbLabel2);
add(jlbLabel3);
}
public static void main(String[] args) {
JFrame frame = new JFrame("jLabel Usage Demo");
frame.addWindowListener(new WindowAdapter() {


public void windowClosing(WindowEvent e) {
System.exit(0);
}
});
frame.setContentPane(new JLabelExample());
frame.pack();
frame.setVisible(true);
}
}

Thanks

December 12, 2008 at 7:15 AM

sir, i got your answer but not resolve my prob.

dear friend, i add JFrame Form in java package and put a button like that code:

public class ClientGUI extends javax.swing.JFrame {
/** Creates new form ClientGUI */
public ClientGUI() {
initComponents();
}

public static void main(String args[]) {
java.awt.EventQueue.invokeLater(new Runnable() {
public void run() {
// ClientGUI frame = new ClientGUI();
// frame.addWindowListener(new WindowAdapter() {
//
//
// public void windowClosing(WindowEvent e) {
// System.exit(0);
// }
// });
// frame.setContentPane(new JLabelExample());
// frame.pack();
// frame.setVisible(true);
new ClientGUI().setVisible(true);
}
});
}

// Variables declaration - do not modify
private javax.swing.JButton jButton1;
// End of variables declaration

}

i commented your suggested code but it removes button because of object intialization









Related Tutorials/Questions & Answers:
java gui
java gui   friends... good day.. i have doubt in java gui. ? i created 1 java gui application. That has two text fields jtext1,jtext2. case: user entered value in first textfield(jtext1) and pressed the enter key . the cursor
Java GUI
Java GUI  1) Using Java GUI, create a rectangular box that changes color each time a user click a change color button. 2) Modify Question 1 to include a new button named insert image, that allow user to insert a bitmap image
Advertisements
Java GUI
Java GUI  difference between swing and applet
Java GUI - Java Beginners
Java GUI  HOW TO ADD ICONS IN JAVA GUI PROGRAMMES
GUI
GUI  How to GUI in Net-beans ... ??   Please visit the following link: http://www.roseindia.net/java/java-tips/background/30java_tools/netbeans.shtml
Java GUI - Java3D
Java GUI  1) Using Java GUI, create a rectangular box that changes color each time a user click a change color button. 2) Modify Question 1 to include a new button named insert image, that allow user to insert a bitmap image
java gui-with jscroll pane
java gui-with jscroll pane  Dear friends.. I have a doubt in my gui application. I developed 1 application. In this application is 1 Jscrollpane of height 600 and width 400. Normally it is showing 200 height and 400 width
java gui-with jscroll pane
java gui-with jscroll pane  Dear friends.. I have a doubt in my gui application. I developed 1 application. In this application is 1 Jscrollpane of height 600 and width 400. Normally it is showing 200 height and 400 width
GUI problem - Java Beginners
GUI problem  how to write java program that use JTextField to input data and JTextField to display the output when user click Display Button??  Handle the actionPerformed event for JButton and try doing something like
GUI 2 - Java Beginners
GUI 2  How can I modify this code? Please give me a GUI...;GUI Example");pack();show();}public void actionPerformed(ActionEvent event... world and like it alot. I was wondering where can I go to learn more about java
Java GUI code
Java GUI code  Write a GUI program to compute the amount of a certificate of deposit on maturity. The sample data follows: Amount deposited: 80000.00 Years: 15 Interest rate: 7.75 Total Amount: Hint** to solve this problem
Java GUI - Applet
Java GUI  HELLO, i am working on java chat server, i add JFrame and make GUI structure by draging buttons and labels, now i want to insert... but not resolve my prob. dear friend, i add JFrame Form in java package and put
Gui Interface - Java Beginners
Gui Interface  hi I have two seperate interfaces in the same projects . my question is how can I access this interface using a jbutton (i.e jbutton = next where next points to another interface addCourse.java) What would
GUI - Java Beginners
GUI testing  GUI testing in software testing  HiNow, use the code and get the answer.import javax.swing.*;public class DemoTryCatchDialog...;GUI Example");pack();show();}public void actionPerformed(ActionEvent event
GUI Interface - Java Beginners
GUI Interface  Respected sir, please send me the codimg of basic... and multiplication. But use classes javax swing java awt java awt.event no other...://www.roseindia.net/java/ Thanks
Java Gui - Java Beginners
Java Gui  HOW TO ADD LINK LABELS IN JAVA PROGRAMMES
java gui database - Java Beginners
java gui database  I have eight files. Each file has exactly same... the data on command line but I do not know how to display the same using java gui. Could anybody help me. Thanks. Shah
Java GUI - Java Beginners
Java GUI  How to use JTray in java programme?  Hi friend, JTrayIcon jtc= new JTrayIcon(image); // jPopupMenu is a javax.swing.JPopupMenu jtc.setRightClickTarget(jPopupMenu); jtc.show(); Thanks
java gui - Java Beginners
java gui  i have to create dynamically databse,table, and number of field..inside that field dynamically data can be entered with type of variable..after entering all the dat in different form field label,i should have a button
GUI testing/software testing - Java Beginners
GUI testing/software testing  how to create a GUI testing/software testing module in java
MultiClient-server tcp-ip with GUI in java
MultiClient-server tcp-ip with GUI in java  i wanna MultiClient-server tcp-ip with GUI in java
MultiClient-server tcp-ip with GUI in java
MultiClient-server tcp-ip with GUI in java  i wanna MultiClient-server tcp-ip with GUI in java
Chat in Java wih GUI
Chat in Java wih GUI  Welcome all >> << how is everybody >< i wanna Chat program in java server & client thanks
GUI - Java Beginners
links: http://www.roseindia.net/tutorial/java/swing/navigatedata.html http://www.roseindia.net/java/example/java/swing/add_edit_and_delete_employee_inf.shtml
Component gui - Java Beginners
Component gui  Can you give me an example of Dialog in java Graphical user interface?  Hi friend, import javax.swing.*; public...://www.roseindia.net/java/example/java/swing/ Thanks
GUI
GUI  Write a GUI application for the WebBuy Company that allows a user to compose the three parts of a complete email message: the ??To:??, ??Subject:?? and ??Message:?? text. The ??To:??, and ??Subject:?? Text areas
Java scroll pane-java GUI
Java scroll pane-java GUI  Dear friends.. Very Good morning. I have a doubt in my gui application. Take ex:- My gui application has 1 Jscrollpane of height 600 and width 400. normally it is showing 200 height and 400 width
Rental Code GUI - Java Beginners
Rental Code GUI  dear sir... i would like to ask some code of java GUI form that ask the user will choose the menu to input Disk #: type: title: record company: price: director: no. of copies
java GUI program - Java Beginners
java GUI program  java program that creates the following GUI, when user enter data in the textfield, the input will be displayed in the textarea...://www.roseindia.net/java/ Thanks. Amardeep
Java GUI IndexOf - Java Beginners
Java GUI IndexOf  Hello and thank you for having this great site. Here is my problem. Write a Java GUI application called Index.java that inputs several lines of text and a search character and uses String method indexOf
Java GUI code- creating a circle
Java GUI code- creating a circle  My assignment is to write a program...; //GUI components JLabel lClx, lCly, lCircumrx, lCircumry, lRadius... //constructor public CircleGUI() { //create GUI lClx
Java GUI Program - Java Beginners
Java GUI Program  How is the following program supposed to be coded? Write an application that prompts the user to enter the radius of a circle...://www.roseindia.net/java/ Thanks. Amardeep
turn the GUI(java class) into XML - XML
turn the GUI(java class) into XML   Hi im trying to turn the GUI(java class) into XML ,means in my gui one combobox is there if i select one... GUI that combobox contains different types of maps.If i select one map name
How to convert this Java code into GUI?
How to convert this Java code into GUI?   import java.util.Scanner; public class StudentMarks { double totalMarks; String grade; public void setTotalMarks(double totalMarks) { this.totalMarks = totalMarks
Convert this code to GUI - Java Beginners
Convert this code to GUI  I have written this.i need to convert the following code to GUI:- import java.awt.*; import java.applet.*; import...); } }  hi friend, We have convert your code into GUI
Writing a GUI program - Java Beginners
Writing a GUI program  Hello everyone! I'm trying to write a program that has a text field for input, two buttons and the output text area. A user... to write the code for the GUI. Could anyone please help?  Hi Friend
Java GUI problem with linklists and administration - Java Beginners
Java GUI problem with linklists and administration  Hi, I'm having trouble making a GUI interface in java, where a list of names are displayed using a jList. The java program should be able to allow the user to add names, remove
Accessing Ms access data in JAVA GUI Envi.
Accessing Ms access data in JAVA GUI Envi.  Q.How to insert data into ms access data in java using swing ? Q.How to slove (access denided ("java.lang.RuntimePermission" "accessClassInPackage.sun.jdbc.odbc")" these exception
how to save a gui form in core java
how to save a gui form in core java  please help me i am java beginner how to save a jframe containing jtable and panels in java thank you
Java gui program for drawing rectangle and circle
Java gui program for drawing rectangle and circle   how to write java gui program for drawing rectangle and circle? there shoud be circle and rectangle button, check box for bold and italic, and radio button red,green and blue
Catching Exceptions in GUI Code - Java Tutorials
.style1 { text-align: center; } Catching uncaught exception in GUI In this section, we will discuss how to catch uncaught exceptions in GUI. Lets see... javax.swing.*; import java.awt.*; import java.awt.event.ActionEvent; public class Gui
GUI convert to celsius program - Java Beginners
GUI convert to celsius program  how to write java GUI program... information on Swing Examples visit to : http://www.roseindia.net/java/example/java/swing/ Thanks
Convert the code to GUI
Java GUI Class Example  Java GUI Class Example
Convert the code to GUI
GUI Java JSP application  GUI Java JSP application
Convert the code to GUI
Java and GUI application Example  Java and GUI application Example
Java GUI to build a Student Registration Program
Java GUI to build a Student Registration Program   Write a program to register students for a college. Students have names, addresses and courses. Implement the interface class RegisterStudent. RegisterStudent has one method
I really need a tutor for Java program that has to do with multithreading and gui!
I really need a tutor for Java program that has to do with multithreading and gui!  I am looking for a Tutor to help me with a Java program, specially GUI and multithreading. If you can tutor, please email me
urgent help needed in JDBC AND JAVA GUI - JDBC
want any one to help me convert from scanner to java GUI for this code...urgent help needed in JDBC AND JAVA GUI  my application allows a student to open a savings account , the student has to submit his or her names
Login Form with Java GUI using Netbeans
Login Form with Java GUI using Netbeans  Hi there! I'm a beginner in Java. I've created 2 class files: 1) TestAssign.java 2) NewFrame.java How can I have different user to login? Now that I've only administrator who is able
GUI and how to convert a distance - Java Beginners
GUI and how to convert a distance  i need help.. how to create a GUI application that can be is used to convert a distance unit in miles into its corresponding units in kilometer, meter, inches and centimeter. When a user

Ads