Creating GUI programs
Not that I have any immediate intention to do so, but I was wondering if you can create simple GUI programs like say a a message box with a line of text on it just using your text editor and the j2sdk. Or does it become necessary to use an IDE for that?
Not that I have any immediate intention to do so, but
I was wondering if you can create simple GUI programs
like say a a message box with a line of text on it
just using your text editor and the j2sdk. Or does it
become necessary to use an IDE for that?IDE's are not necessary to do anything. You can create any program you want with just a text editor and the SDK.
IDE's add a level of simplicity to the process (some do).
Similar Messages
-
Conceptual difficulty with GUI programming and SWING
I am having a hard time understanding how to create GUIs in an object oriented environment. My problem is not in how the code fits together, that bit is relatively easy, but in how to model the GUI into different classes etc.
The most basic swing element is the container right? So I create a container and then add the different buttons, textfields etc on top of it. But then I have to listen for events on all these elements and all of a sudden the class is getting VERY busy. I read somewhere that you should try to keep each class as neat and tidy as possible which this isn't.
Maybe I am not explaining myself. I am very confused. I understand the business objects paradigm where each class does a specific thing but why doesn't it then happen in Swing? Suddenly the "object is king" paradigm goes out the window and we are back to old fashioned procedural programming. Crazy, or am I just not getting it?I think I know where you're coming from as I had a
mental block on this problem as well.
Try subclassing JFrame and then making all the
buttons etc attributes of YourJFrame class. Then
create a Driver class which will handle all the mouse
events etc.You should probably not subclass JFrame. Normally you create a JPanel, and adds controls to it, or you subclass JPanel. You should then add the panel to the JFrame.
Kaj -
For the first time in my C.S. education I will be forced to develop applications that use swing in order to create GUIs. My question is this: Will I absolutely NEED to be able to program without the use of an IDE, or should I (for the most part) be able to rely on an IDE such as NetBeans?
I ask this because I'm going to be doing my first team project using Swing and CVS, and I'm wondering if I should know how to program the GUI using just a text editor.
Thanks,
jlgosseFor the first time in my C.S. education I will be
forced to develop applications that use swing in
order to create GUIs. My question is this: Will I
absolutely NEED to be able to program without the use
of an IDE, or should I (for the most part) be able to
rely on an IDE such as NetBeans?Two or three months ago, I decided to learn Java. I also wanted to build GUIs with it. I downloaded NetBeans, and made a start using that to build my GUIs. I was therefore a beginner with the language as a whole, Swing in particular, and NetBeans into the bargain.
What I found was this:
The Swing code that NetBeans generated was convoluted and complex. It makes use of a layout manager called GroupLayout, that I believe was built specifically for IDE GUI generators. It does not lend itself easily to human consumption. Also, NetBeans does not allow you to directly alter the generated code.
There were some things I could not seem to do in NetBeans, either through a limitation in it, or because of my inexperience in using it. I had great trouble placing one object on top of another, for example (only one is ever visible).
Creating standard forms / panels in NetBeans is easy and the visual tool is user friendly. It also allows you to marshal the events and event handling. This is a boon to the beginner.
However, having said all that, I concluded very early on that if I were to ever really get to grips with Swing, then I should learn about it, and then hand craft my GUIs. Whilst this was painful at first, and after reading a great deal, I can now knock up a GUI in double quick time, that I have complete control of, and that uses far less code than the GUI builder would.
So to answer your question. I would say that your first assignment using Swing will probably be quite straightforward, so I don't see any reason why you can't rely on NetBeans to help you.
But, if you ever want to really rock and roll with Swing, I would say you will need to go through a learning exercise with it, drop the IDE, and get to the point where hand crafting a GUI is, if not a pleasure, then at least not a horribly daunting task.
Should you ever do this, please ensure you fully understand the issue of concurrency.
I hope this was of some value to you, and good luck with your assignment. -
Client-Server side GUI programming
I want to create a client-server side gui programming with java
i read this web adress
http://java.sun.com/docs/books/tutorial/networking/sockets/clientServer.html
for information but there are some parts that i didnt understand and wait for your help
i m trying to build an online-help(live chat) system so when people press the start chat button a java page will appear but i wonder how this will connect to the person who is on server side
i mean is it possible to 2 users connect the same port and chat with each other
I mean when user press the chat button the online help supporter will be informed somebody wants to speak with him and they will start a chat
how can i do something like that
any help would be usefull thanksBelow is an example of a client/server program.
It shows how the server listens for multiple clients.
* TriviaServerMulti.java
* Created on May 12, 2005
package server;
* @author johnz
import java.io.*;
import java.net.*;
import java.util.Random;
* This TriviaServer can handle multiple clientSockets simultaneously
* This is accomplished by:
* - listening for incoming clientSocket request in endless loop
* - spawning a new TriviaServer for each incoming request
* Client connects to server with:
* telnet <ip_address> <port>
* <ip_address> = IP address of server
* <port> = port of server
* In this case the port is 4413 , but server can listen on any port
* If server runs on the same PC as client use IP_addess = localhost
* The server reads file
* Note: a production server needs to handle start, stop and status commands
public class TriviaServerMulti implements Runnable {
// Class variables
private static final int WAIT_FOR_CLIENT = 0;
private static final int WAIT_FOR_ANSWER = 1;
private static final int WAIT_FOR_CONFIRM = 2;
private static String[] questions;
private static String[] answers;
private static int numQuestions;
// Instance variables
private int num = 0;
private int state = WAIT_FOR_CLIENT;
private Random rand = new Random();
private Socket clientSocket = null;
public TriviaServerMulti(Socket clientSocket) {
//super("TriviaServer");
this.clientSocket = clientSocket;
public void run() {
// Ask trivia questions until client replies "N"
while (true) {
// Process questions and answers
try {
InputStreamReader isr = new InputStreamReader(clientSocket.getInputStream());
BufferedReader is = new BufferedReader(isr);
// PrintWriter os = new PrintWriter(new
// BufferedOutputStream(clientSocket.getOutputStream()), false);
PrintWriter os = new PrintWriter(clientSocket.getOutputStream());
String outLine;
// Output server request
outLine = processInput(null);
os.println(outLine);
os.flush();
// Process and output user input
while (true) {
String inLine = is.readLine();
if (inLine.length() > 0)
outLine = processInput(inLine);
else
outLine = processInput("");
os.println(outLine);
os.flush();
if (outLine.equals("Bye."))
break;
// Clean up
os.close();
is.close();
clientSocket.close();
return;
} catch (Exception e) {
System.err.println("Error: " + e);
e.printStackTrace();
private String processInput(String inStr) {
String outStr = null;
switch (state) {
case WAIT_FOR_CLIENT:
// Ask a question
outStr = questions[num];
state = WAIT_FOR_ANSWER;
break;
case WAIT_FOR_ANSWER:
// Check the answer
if (inStr.equalsIgnoreCase(answers[num]))
outStr="\015\012That's correct! Want another (y/n)?";
else
outStr="\015\012Wrong, the correct answer is "
+ answers[num] +". Want another (y/n)?";
state = WAIT_FOR_CONFIRM;
break;
case WAIT_FOR_CONFIRM:
// See if they want another question
if (!inStr.equalsIgnoreCase("N")) {
num = Math.abs(rand.nextInt()) % questions.length;
outStr = questions[num];
state = WAIT_FOR_ANSWER;
} else {
outStr = "Bye.";
state = WAIT_FOR_CLIENT;
break;
return outStr;
private static boolean loadData() {
try {
//File inFile = new File("qna.txt");
File inFile = new File("data/qna.txt");
FileInputStream inStream = new FileInputStream(inFile);
byte[] data = new byte[(int)inFile.length()];
// Read questions and answers into a byte array
if (inStream.read(data) <= 0) {
System.err.println("Error: couldn't read q&a.");
return false;
// See how many question/answer pairs there are
for (int i = 0; i < data.length; i++)
if (data[i] == (byte)'#')
numQuestions++;
numQuestions /= 2;
questions = new String[numQuestions];
answers = new String[numQuestions];
// Parse questions and answers into String arrays
int start = 0, index = 0;
String LineDelimiter = System.getProperty("line.separator");
int len = 1 + LineDelimiter.length(); // # + line delimiter
boolean isQuestion = true;
for (int i = 0; i < data.length; i++)
if (data[i] == (byte)'#') {
if (isQuestion) {
questions[index] = new String(data, start, i - start);
isQuestion = false;
} else {
answers[index] = new String(data, start, i - start);
isQuestion = true;
index++;
start = i + len;
} catch (FileNotFoundException e) {
System.err.println("Exception: couldn't find the Q&A file.");
return false;
} catch (IOException e) {
System.err.println("Exception: couldn't read the Q&A file.");
return false;
return true;
public static void main(String[] arguments) {
// Initialize the question and answer data
if (!loadData()) {
System.err.println("Error: couldn't initialize Q&A data.");
return;
ServerSocket serverSocket = null;
try {
serverSocket = new ServerSocket(4413);
System.out.println("TriviaServer up and running ...");
} catch (IOException e) {
System.err.println("Error: couldn't create ServerSocket.");
System.exit(1);
Socket clientSocket = null;
// Endless loop: waiting for incoming client request
while (true) {
// Wait for a clientSocket
try {
clientSocket = serverSocket.accept(); // ServerSocket returns a client socket when client connects
} catch (IOException e) {
System.err.println("Error: couldn't connect to clientSocket.");
System.exit(1);
// Create a thread for each incoming request
TriviaServerMulti server = new TriviaServerMulti(clientSocket);
Thread thread = new Thread(server);
thread.start(); // Starts new thread. Thread invokes run() method of server.
}This is the text file:
Which one of the Smothers Brothers did Bill Cosby once punch out?
(a) Dick
(b) Tommy
(c) both#
b#
What's the nickname of Dallas Cowboys fullback Daryl Johnston?
(a) caribou
(b) moose
(c) elk#
b#
What is triskaidekaphobia?
(a) fear of tricycles
(b) fear of the number 13
(c) fear of kaleidoscopes#
b#
What southern state is most likely to have an earthquake?
(a) Florida
(b) Arkansas
(c) South Carolina#
c#
Which person at Sun Microsystems came up with the name Java in early 1995?
(a) James Gosling
(b) Kim Polese
(c) Alan Baratz#
b#
Which figure skater is the sister of Growing Pains star Joanna Kerns?
(a) Dorothy Hamill
(b) Katarina Witt
(c) Donna De Varona#
c#
When this Old Man plays four, what does he play knick-knack on?
(a) His shoe
(b) His door
(c) His knee#
b#
What National Hockey League team once played as the Winnipeg Jets?
(a) The Phoenix Coyotes
(b) The Florida Panthers
(c) The Colorado Avalanche#
a#
David Letterman uses the stage name "Earl Hofert" when he appears in movies. Who is Earl?
(a) A crew member on his show
(b) His grandfather
(c) A character on Green Acres#
b#
Who created Superman?
(a) Bob Kane
(b) Jerome Siegel and Joe Shuster
(c) Stan Lee and Jack Kirby#
b# -
How to Create another program instance in iphone from a COPY previous proj
Say I've created one program by starting Xcode afresh.
Now I want to create another program using the previous program as a base, I copy and paste the project folder and rename it, unfortunately, when I run the program, it replaces the previous program in my iPhone.
How do I tell xcode it's a new program ?
Message was edited by: Bracer-JThank you
-
Is it possible to create a program for embedded system
Is it possible to create a program for embedded system?
Yes. Many solutions.
1 = http://jcx.systronix.com/
2 = http://www.harbaum.org/till/nanovm/index.shtml (see links to Asuro)
And many more but I'm too lazy too look them for you ...
Dan -
Create a program, based on a report painter query
Hi!
I would like to create a program, which contains the same data, what I can get from a report, which is made by report painter in transaction GRR2. The given report is for checking the service orders.
This report has a key (order number) and additional columns, like material cost, personal cost, external service cost, money income, etc...
I would like to know, how can I identify the tables, columns and table entries, where these values come from?
How can I retrieve from the SAP, for example the material cost of the service orders?
And of course with the less hard-coding.
Thank you
TamáHow to find the cost element to filter
- Ask your FI-CO team.
- Analyze the Customizing (IMG): "Materials Management", "Valuation and Account Assignment", "Account Determination" to find the cost element/account used for MM. go to "Account Determination Without Wizard", "Configure Automatic Postings"
- Look at table T030 which links Operation/Transaction key and Account, and filter KTOSL on Operation Group T030A-GRUP = 'RMK' for MM.
Ask also the CO team if they maintain a hierarchy of cost element that you could use in your report.
Also use SE30, when analysing the result you could find the way used by the generated program to spread the cost elements in column.
Regards -
Create a program, based on a report painter query issue continues
Hi!
I would like to create a program, which contains the same data, what I can get from a report, which is made by report painter in transaction GRR2. The given report is for checking the service orders.
This report has a key (order number) and additional columns, like material cost, personal cost, external service cost, money income, etc...
I found the COSP table, which can be very useful. Unfortunately COSP table contains only the costart (KSTAR) and I don't know, which costarts can be attached to the material costs, which costarts to the services, which costarts belong to the money income, etc...
Could you please tell me, where can I find this assignment?
Thank you
TamáSolved, here:
Create a program, based on a report painter query -
I have created a program to all my specifications and i am now ready to connect the hardware.
My program was created to automate the cleaning process of an atmostpheric chamber. It controls two valves based on the pressure readings and time intervals. When creating this program i figured that if a could make a boolean turn on or off based on the pressure readings then it would be no problem somehow wiring it to send a signal to the hardware. I have reached that point and don't know how to proceed. I was told that the first step is to figure out what kind of Card is being interfaced with the program.
I have read up on this subject and it seems like there is many ways to do it.
All sugestions will be greatly appreciatedI'm not sure how you can create the program without knowing what hardware you're going to be using. But... What have you read up on? You will need to select your data acquisition hardware. What kind of signals do you have? What kind of transducers do you have? What kind of actuators do you have? You may want to start with:
Introduction to Data Acquisition
Digital Voltage Measurement Fundamentals
Complete Data Acquisition Tutorial
EDIT: Re-reading your post and seeing Waldemar's response: Do you actually already have a card installed?
Message Edited by smercurio_fc on 07-29-2008 02:25 PM -
Function Module to create a program in SE38
Hi,
I have to create an ABAP program dynamically. The program name(to be created) will be provided in the selection screen and the logic of the program will be available in an internal table & also in a local PC file. Is there any Function Module available in SAP to create the program dynamically by using the code which is available in the internal table. The program should be saved in the Local Object.
Can someone help me on this issue. Thanks in advance.
Best Regards,
Paddu.Hello Paddu.
This code fullfills your requirement. Only has the resctriction that all the file names must be in uppercase.
REPORT zcreate_report.
* TYPES
TYPES: BEGIN OF ty_code,
line TYPE char255,
END OF ty_code.
* CLASSES
CLASS cl_gui_frontend_services DEFINITION LOAD.
* INTERNAL TABLES
DATA: data_tab TYPE STANDARD TABLE OF file_info.
DATA: wa TYPE file_info.
DATA: ti_code TYPE STANDARD TABLE OF ty_code.
* VARIABLES
DATA: name TYPE PROGNAME.
DATA: count TYPE i.
DATA: bytecount TYPE i.
DATA: filename TYPE string.
* SELECTION-SCREEN
PARAMETERS: p_dir TYPE string OBLIGATORY DEFAULT 'C:\test\'.
*** START-OF-SELECTION
START-OF-SELECTION.
CLEAR count.
CALL METHOD cl_gui_frontend_services=>directory_list_files
EXPORTING
directory = p_dir
files_only = 'X'
directories_only = space
CHANGING
file_table = data_tab
count = count.
IF count EQ 0.
MESSAGE i000(zsd1) WITH 'No files found'.
EXIT.
ENDIF.
LOOP AT data_tab INTO wa.
CALL FUNCTION 'AIPC_CONVERT_TO_UPPERCASE'
EXPORTING
i_input = wa-filename
IMPORTING
e_output = wa-filename.
CONCATENATE p_dir wa-filename INTO filename.
CALL FUNCTION 'GUI_UPLOAD'
EXPORTING
filename = filename
filetype = 'ASC'
IMPORTING
filelength = bytecount
TABLES
data_tab = ti_code
EXCEPTIONS
file_open_error = 1
file_read_error = 2
no_batch = 3
gui_refuse_filetransfer = 4
invalid_type = 5
no_authority = 6
unknown_error = 7
bad_data_format = 8
header_not_allowed = 9
separator_not_allowed = 10
header_too_long = 11
unknown_dp_error = 12
access_denied = 13
dp_out_of_memory = 14
disk_full = 15
dp_timeout = 16
OTHERS = 17.
CHECK sy-subrc EQ 0.
READ TABLE ti_code TRANSPORTING NO FIELDS INDEX 1.
CHECK sy-subrc EQ 0.
name = wa-filename.
INSERT REPORT name FROM ti_code.
ENDLOOP.
Regards.
Valter Oliveira. -
Is pages the best app for creating wedding programs, or would you reccomend something free or cheaper?
As the question is asked three times, I guess that you wish to marry three times.
From my point of view, the best app to do this or that is the one with which we are comfortable.
Every Word processor may be used to achieve your goal.
Yvan KOENIG (VALLAURIS, France) vendredi 20 janvier 2012
iMac 21”5, i7, 2.8 GHz, 12 Gbytes, 1 Tbytes, mac OS X 10.6.8 and 10.7.2
My Box account is : http://www.box.com/s/00qnssoyeq2xvc22ra4k
My iDisk is : http://public.me.com/koenigyvan -
Hi,
I'm new to swing and until now have created GUI using MFC.
Are there any wizard like tools, that help creating the UI while generating the adaquate code for me?
Thanks.U can use JBuilder /NetBeans / Forte4 etc ..
Lot of tools are available . u download and create GUI ...
all the best !! -
Creating GUI + EventQueue.invokeAndWait problem
Hi,
Currently I am creating GUI to my application ,thanks to NetBeans Graphic Editor ,I created simple grame with one buton.Now i am trying to add action to this button listener.Generally i want to make that if this button is pressed,new frame with game itself is opening.Firstly I tried with following code:
java.awt.EventQueue.invokeLater(new Runnable() {
public void run() {
a = new NewJFrame1();
a.setVisible(true);
});Everything seemed to be fine apart form the fact that when the new frame has opened,key listenesr in this new game frame weren't working.I read a liitle and I decided to modify my code a bit:
java.awt.EventQueue.invokeAndWait(new Runnable() {
public void run() {
a = new NewJFrame1();
a.setVisible(true);
});Unfortunately I got error message from complier:
ava:154: unreported exception java.lang.InterruptedException; must be caught or declared to be thrown
java.awt.EventQueue.invokeAndWait(new Runnable() {
I thought that i need to add try block with catching InterruptedException but still doesn't work.
Please help my please.I would be grateful if someone could correct this short code so it is working propoerlyprivate void jButton1ActionPerformed(java.awt.event.ActionEvent evt) throws InterruptedException {
try{
java.awt.EventQueue.invokeAndWait(new Runnable() {
public void run() {
// try{
new ramka().setVisible(true);
// if(a.isVisible()==false){b.setVisible(false);}
// catch(InterruptedException e){}
catch(InterruptedException e){}
} -
Hi
I am creating gui status in a function group from se80
I created same menu in two different gui statuses.
I want different fields in the menu.
I have 'goto' menu in first and second gui status.
I want different fields in the 'goto' menu in both gui statuses
when i change the fields of the menu in one gui status it automatically changes in the second guistatus
kindly help me,
thanksHi,
Try this..
Delete the second gui status...
Then create the second gui status by not copying...
add the menu and function codes one by one...and then when you enter the same menu..it will ask whether do you want to copy the existing menu or create new menu....here say create new menu....It should work..
Thanks
Naren -
Who created which program and when?
Hi all,
Who created which program and when?
How can I get this info, thanks.
Deniz.Hi Thomas,
Yep True....
Very True...
Thanks for sharing your knowledge...
But If User wants something else in selection screen then what is available in standard se90 or se84 or any other TCODE or Program....
Again There can be many solution for one problem... And I provided one of the solution...
If user wants program type in seleciton screen
like
Created DATE
Created By
Modified DATE
Modified By
If user wants these and may be some other details in selection screen then ???
Alternative is to use direct SE16 as well...
So there are many solutions to one problem... it all depends on user/customer/client's requirement...
Correct me if i am wrong..
Thanks & Regards
ilesh 24x7
Maybe you are looking for
-
Questions on URLs and dynamic navigation rules
Hello, I am new to JSF, so any help is appreciated. I am trying to do the following: Dynamic display URI - users submit multiple parameters for a search. The URL needs to change depending on search parameters they submit. For example, if they search
-
How to call a BW Query from an ABAP program?
How to call a BW Query from an ABAP program?
-
Why Favicons aren't displayed and no addon can solve this problem ?
This problem occurs in Firefox and Nightly. Is it normal our it's a bug. I find favicons useful and I hope to see them again like they exist in IE or other browser. Thanks for answer.
-
Pages not Loading-HELP! Going crazy here!
I cannot figure this out to save my life. I cannot create a link that works from one page to the next. I mean the link works but you don't see anything. The page comes up black. On the Highlight page you can hear the film playing in the back but can'
-
Aperture 3: Geotagged Photos show up in wrong part of world
I imported a set of geotagged photos. When I look at places in Aperture 3 several of the photos are appearing in the wrong part of the world ( Kazakhstan instead of Nova Scotia). The photos were taken / geotagged by my Blackberry Storm. When I travel