Linking gui's
how do i get a button, that when pressed will display another gui?
need help urgent.....
thanks
Hi,
If your class files are below the code base and your package setup
reflects this then it should work. If you put your code in one file
representing several classes then this will work also without
setting any package names.
Look at the demo code under the JDK install directory
demo/applets this should help you or take a look
at the tutorial this walks you through an example.
Dave Nicholson Sun Developer Tech Support.
Similar Messages
-
New help on java swing GUI.....
k, im new to java. Just started learning a month ago. Anyway, I was wondering how one can link gui together using buttons. For example, when i press enter on a registration gui, it'll take me to the confirmation gui. What's the best way to do this? anyone has any idea or can point me to a website with info. Thanks A lots folks.
Well, bascially you would add a Button (e.g. "Next" or "Submit") to your Window/Panel (whatever you prefer). This add has an ActionListener assigned which will open up the next Window/Panel.
Then you define this button to be your default button on that window (check JRootPane.setDefaultButton() for this) so that Enter will fire the button.
Check the Swing online tutorial for an introduction to Swing and how Buttons (and their associated ActionListener) work.
Thomas -
hi guys,
i am using gui_download to download file to a excel i have given field seperator as
" " empty. and the file type as asc. iwhen i download the file i am getting all the field clubbed into the excel in the first field only .also the output is in exponent format . how to get the output in seperate colums and to get without exponential format.
reward is surehi..
Check the below program :
REPORT Z4PG_EXTEND_MATERIAL
NO STANDARD PAGE HEADING
LINE-SIZE 150
MESSAGE-ID Z4.
TABLES :
mard, "#EC * " Storage Location Data for Material
marc. "#EC * " Plant Data for Material
INTERNAL TABLES DECLARATIONS
1. INTERNAL TABLE FOR MATERIALS THAT ARE MAINTAINED FOR lgort = '0001'
DATA : BEGIN OF it_mard OCCURS 0,
matnr LIKE mard-matnr, " Material No.
werks LIKE mard-werks, " Plant
lgort LIKE mard-lgort, " Storage Location
END OF it_mard.
2. INTERNAL TABLE TO STORE MATERIALS WHICH ARE ALREADY MAINTAINED FOR
*lgort = 'ABCD'.
DATA: BEGIN OF it_verify OCCURS 0,
matnr LIKE mard-matnr, " Material No.
werks LIKE mard-werks, " Plant
lgort LIKE mard-lgort, " Storage Location
dismm LIKE marc-dismm, " MRP type
END OF it_verify.
3. INTERNAL TABLE TO STORE MATERIALS WHICH HAS NO MRP TYPE ASSIGNED.
DATA: BEGIN OF it_marc OCCURS 0,
matnr LIKE marc-matnr, " Material No.
werks LIKE marc-werks, " Plant
dismm LIKE marc-dismm, " MRP type
END OF it_marc.
3. INTERNAL TABLE TO STORE MATERIALS WHICH ARE ALREADY MAINTAINED FOR
*lgort = 'ABCD'.
DATA: BEGIN OF it_error OCCURS 0, "#EC *
index TYPE I,
fname(25),
fval(30),
err_msg(40),
END OF it_error.
DATA: BEGIN OF it_error1 OCCURS 0, "#EC *
matnr LIKE mard-matnr,
type LIKE bapiret2-type,
id LIKE bapiret2-id,
message LIKE bapiret2-message,
END OF it_error1.
TABLES FOR FUNCTION - BAPI_MATERIAL_SAVEDATA
DATA: I_HEADDATA LIKE BAPIMATHEAD, " HEADER DATA
I_STORAGELOCATIONDATA LIKE BAPI_MARD, " STORAGE
*LOCATION SPECIFIC MATERIAL DATA
I_STORAGELOCATIONDATAX LIKE BAPI_MARDX, " Information on
*update for STORAGELOCATIONDATA
I_RETURN LIKE BAPIRET2, " RETURN FROM
*BAPI
I_RETURNMESSAGES LIKE BAPI_MATRETURN2 OCCURS 0 WITH
HEADER LINE.
SELECTION PARAMETERS
SELECTION-SCREEN BEGIN OF BLOCK MAIN WITH FRAME TITLE TEXT-001.
SELECT-OPTIONS s_matnr FOR mard-matnr. " Material Number
SELECTION-SCREEN END OF BLOCK MAIN.
SELECTION SCREEN VALIDATION.
AT SELECTION-SCREEN .
PERFORM validate_material.
START OF SELECTION
START-OF-SELECTION.
PERFORM extract_itmard.
PERFORM extract_itmarc.
PERFORM extract_itverify.
PERFORM verify_material.
PERFORM display_error_report.
*& Form extract_itmard
text
--> p1 text
<-- p2 text
form extract_itmard .
SELECT matnr werks lgort
FROM mard
INTO TABLE it_mard
WHERE matnr IN s_matnr AND
werks = 'RAPI' AND " Plant
lgort = 'RAPI' . " Storage Location
IF sy-subrc NE 0.
MESSAGE s114. " Success Message --> Data
Not Available
STOP.
ENDIF.
endform. " extract_itmard
*& Form extract_itmarc
text
--> p1 text
<-- p2 text
form extract_itmarc . "Fetch Materials for which the MRP
*Type is not maintained
SELECT matnr werks dismm
FROM marc
INTO TABLE it_marc
FOR ALL ENTRIES IN it_mard
WHERE matnr = it_mard-matnr AND
werks = it_mard-werks AND
dismm = ' '.
endform. " extract_itmarc
*& Form extract_itverify
text
--> p1 text
<-- p2 text
form extract_itverify . " Fetch All the Materials
which are already extended for the Storage Location
IF it_mard[] IS NOT INITIAL. "Check it_likp for not
null
SELECT matnr werks lgort
FROM mard
INTO TABLE it_verify
FOR ALL ENTRIES IN it_mard
WHERE matnr = it_mard-matnr AND
werks = 'RAPI' AND " For Plant
lgort = '0001'. " For Storage
Location
ELSE.
MESSAGE s114. "Success Message -->
Data Not Available
STOP.
ENDIF.
endform. " extract_itverify
*& Form verify_material
text
--> p1 text
<-- p2 text
FORM verify_material .
DATA: v_cnt TYPE I.
v_cnt = 1.
IF it_verify[] IS NOT INITIAL AND it_marc[] IS NOT INITIAL.
"Check it_likp for not null
SORT it_mard BY matnr.
SORT it_verify BY matnr.
ENDIF.
LOOP AT it_mard.
IF it_verify[] IS NOT INITIAL. " Check it_verify
for not null
READ TABLE it_verify WITH KEY matnr = it_mard-matnr BINARY
SEARCH. " Check Material is not extended
IF sy-subrc <> 0.
READ TABLE it_marc WITH KEY matnr = it_mard-matnr BINARY
SEARCH. " Check MRP Type for the Material is Maintained
IF sy-subrc <> 0.
PERFORM extend_material USING it_mard-matnr
" Extend Material
it_mard-werks.
ELSE.
it_error-index = v_cnt.
" Generate Error Report
it_error-fname = 'MATERIAL NO'.
it_error-fval = it_mard-matnr.
it_error-err_msg = 'MRP Type Not Maintained'.
APPEND it_error.
v_cnt = v_cnt + 1.
ENDIF.
ENDIF.
ELSE.
READ TABLE it_marc WITH KEY matnr = it_mard-matnr BINARY
SEARCH.
IF sy-subrc <> 0.
PERFORM extend_material USING it_mard-matnr
it_mard-werks.
ENDIF.
ENDIF.
ENDLOOP.
ENDFORM. " verify_material
*& Form extend_material
text
-->P_IT_MARD_MATNR text
-->P_IT_MARD_WERKS text
-->P_IT_MARD_LGORT text
FORM extend_material USING P_IT_MARD_MATNR TYPE mard-matnr
P_IT_MARD_WERKS TYPE mard-werks.
DATA: v_str(50).
CLEAR I_HEADDATA.
I_HEADDATA-MATERIAL = P_IT_MARD_MATNR.
I_HEADDATA-MRP_VIEW = 'X'.
CLEAR I_STORAGELOCATIONDATA.
CLEAR I_STORAGELOCATIONDATAX.
I_STORAGELOCATIONDATA-PLANT = P_IT_MARD_WERKS.
I_STORAGELOCATIONDATA-STGE_LOC = '0001'.
I_STORAGELOCATIONDATAX-PLANT = P_IT_MARD_WERKS.
I_STORAGELOCATIONDATAX-STGE_LOC = '0001'.
CALL FUNCTION 'BAPI_MATERIAL_SAVEDATA'
EXPORTING
headdata = i_headdata
CLIENTDATA =
CLIENTDATAX =
PLANTDATA =
PLANTDATAX =
FORECASTPARAMETERS =
FORECASTPARAMETERSX =
PLANNINGDATA =
PLANNINGDATAX =
STORAGELOCATIONDATA = i_storagelocationdata
STORAGELOCATIONDATAX = i_storagelocationdatax
VALUATIONDATA =
VALUATIONDATAX =
WAREHOUSENUMBERDATA =
WAREHOUSENUMBERDATAX =
SALESDATA =
SALESDATAX =
STORAGETYPEDATA =
STORAGETYPEDATAX =
FLAG_ONLINE = ' '
FLAG_CAD_CALL = ' '
NO_DEQUEUE = ' '
IMPORTING
RETURN = i_return
TABLES
MATERIALDESCRIPTION =
UNITSOFMEASURE =
UNITSOFMEASUREX =
INTERNATIONALARTNOS =
MATERIALLONGTEXT =
TAXCLASSIFICATIONS =
RETURNMESSAGES = i_returnmessages
PRTDATA =
PRTDATAX =
EXTENSIONIN =
EXTENSIONINX =
LOOP at i_returnmessages.
write: / i_returnmessages-message.
ENDLOOP.
v_str = 'Material No does not Exist'.
IF i_return-type = 'E'.
it_error1-matnr = P_IT_MARD_MATNR.
it_error1-type = i_return-type.
it_error1-id = i_return-id.
it_error1-message = v_str.
APPEND it_error1.
ELSEIF i_return-type = 'S'.
READ TABLE i_returnmessages WITH KEY TYPE = 'S' id = 'M3'.
IF sy-subrc = 0.
it_error1-matnr = P_IT_MARD_MATNR.
it_error1-type = i_return-type.
it_error1-id = i_return-id.
it_error1-message = i_returnmessages-message.
APPEND it_error1.
CLEAR it_error1.
ENDIF.
ENDIF.
REFRESH i_returnmessages.
CLEAR it_error1.
CLEAR i_return.
ENDFORM. " extend_material
*& Form display_error_report
text
--> p1 text
<-- p2 text
FORM display_error_report .
CALL FUNCTION 'GUI_DOWNLOAD'
EXPORTING
BIN_FILESIZE =
FILENAME = 'C:/Error1.txt'
FILETYPE = 'ASC'
APPEND = ' '
WRITE_FIELD_SEPARATOR = ' '
HEADER = '00'
TRUNC_TRAILING_BLANKS = ' '
WRITE_LF = 'X'
COL_SELECT = ' '
COL_SELECT_MASK = ' '
DAT_MODE = ' '
IMPORTING
FILELENGTH =
TABLES
DATA_TAB = it_error1
EXCEPTIONS
FILE_WRITE_ERROR = 1
NO_BATCH = 2
GUI_REFUSE_FILETRANSFER = 3
INVALID_TYPE = 4
NO_AUTHORITY = 5
UNKNOWN_ERROR = 6
HEADER_NOT_ALLOWED = 7
SEPARATOR_NOT_ALLOWED = 8
FILESIZE_NOT_ALLOWED = 9
HEADER_TOO_LONG = 10
DP_ERROR_CREATE = 11
DP_ERROR_SEND = 12
DP_ERROR_WRITE = 13
UNKNOWN_DP_ERROR = 14
ACCESS_DENIED = 15
DP_OUT_OF_MEMORY = 16
DISK_FULL = 17
DP_TIMEOUT = 18
FILE_NOT_FOUND = 19
DATAPROVIDER_EXCEPTION = 20
CONTROL_FLUSH_ERROR = 21
OTHERS = 22
IF SY-SUBRC <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
CALL FUNCTION 'GUI_DOWNLOAD'
EXPORTING
BIN_FILESIZE =
FILENAME = 'C:/Error.txt'
FILETYPE = 'ASC'
APPEND = ' '
WRITE_FIELD_SEPARATOR = ' '
HEADER = '00'
TRUNC_TRAILING_BLANKS = ' '
WRITE_LF = 'X'
COL_SELECT = ' '
COL_SELECT_MASK = ' '
DAT_MODE = ' '
IMPORTING
FILELENGTH =
TABLES
DATA_TAB = it_error
EXCEPTIONS
FILE_WRITE_ERROR = 1
NO_BATCH = 2
GUI_REFUSE_FILETRANSFER = 3
INVALID_TYPE = 4
NO_AUTHORITY = 5
UNKNOWN_ERROR = 6
HEADER_NOT_ALLOWED = 7
SEPARATOR_NOT_ALLOWED = 8
FILESIZE_NOT_ALLOWED = 9
HEADER_TOO_LONG = 10
DP_ERROR_CREATE = 11
DP_ERROR_SEND = 12
DP_ERROR_WRITE = 13
UNKNOWN_DP_ERROR = 14
ACCESS_DENIED = 15
DP_OUT_OF_MEMORY = 16
DISK_FULL = 17
DP_TIMEOUT = 18
FILE_NOT_FOUND = 19
DATAPROVIDER_EXCEPTION = 20
CONTROL_FLUSH_ERROR = 21
OTHERS = 22
IF SY-SUBRC <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
ENDFORM. " display_error_report
*& Form validate_material
text
--> p1 text
<-- p2 text
form validate_material .
IF NOT s_matnr[] IS INITIAL.
SELECT matnr
INTO mard-matnr
FROM mard
UP TO 1 ROWS
WHERE matnr IN s_matnr.
ENDSELECT.
IF SY-SUBRC <> 0.
MESSAGE E115 WITH 'Invalid' mard-matnr. " Error
Message-->Invalid Parameters
ENDIF.
ENDIF.
IF NOT s_matnr[] IS INITIAL.
SELECT matnr
INTO marc-matnr
FROM marc
UP TO 1 ROWS
WHERE matnr IN s_matnr.
ENDSELECT.
IF sy-subrc <> 0.
MESSAGE s114. "Success Message -->
Data Not Available
STOP.
ENDIF.
ENDIF.
endform. " validate_material
Some frums links
gui download
Sample code for FTP download
http://www.sapdevelopment.co.uk/file/file_updownpop.htm
<b>Reward points if useful</b>
Regards
Ashu -
Adding link on SAP Gui logon page
Hi All,
I have the problem that I need to add a link on the SAP Gui logon page.
Within the transaction SE61 I have added the general text ZLOGIN_SCREEN_INFO.
When I click on the Insert Command I have the possibility to create a link but the char. format F4 list is empty and it does not accept the link creation without it being filled.
Does anybody have an idear?
Thank you for your help
SoerenHi Juan,
When I click on the Insert Command I have the possibility to create a link but the char. format F4 list is empty and it does not accept the link creation without it being filled.
Would you please comment on this ?
I have also seen the only possibility... but same issue...
Regards.
Rajesh Narkhede -
Greetings,
I wish to add a link to my JAVA application program GUI. i.e. i will add a label representing my email address, so when a person clicks it, it automatically opens the computers email program eg. Outlook express with the email address placed in the To box.
Like a hyper link. How can I make a link to a website that way too?
Thank you,
RamboTangoRound your text string of JLabel <HTML>...</HTML>.
For example:
label = new JLabel("<HTML><B>Your Text</B>on label:</HTML>");
You my use close tags </B> or </HTML> or not use - as you wish. -
How to Open GUI Transaction when clicking in Hyper Link
Hello All,
I want to open GUI Transaction when user will click on Hyper Link created in a particular column in a table view. For that I have created Transaction Launcher ID using Transaction Launcher Wizard. Then what will be the next step, i'm not getting. Can anybody help me out on this?
Thanks in advance,
MadhusudanHi,
Here is the sample code:
DATA: lr_navigation TYPE REF TO if_crm_ui_navigation_service.
lr_navigation = cl_crm_ui_navigation_service=>get_instance( me ).
CHECK lr_navigation IS BOUND.
lr_navigation->navigate( iv_link_id = 'ZLINKID' ).
-ASB -
How can I link the buttons in the GUI to a javabean, please give example!
You just need to have your bean instanciated and visible in the same scope as where you want to use it in your GUI.
-
Linking "ant" project with GUI
Hello,
I have an "ant" project (is a speech recognition system) that I want to link to a GUI. I did not make the "ant" project but I know how to use it; I have no experience working with "ant" projects or files.
Does anyone have any ideas? or, Does anyone have a link where I can learn more about "ant"? I'm using netbeans for my application. I googled ant but have not found anything that can help; I'll keep googling but suggestions are appreciated.I googled ant but have not found anything that can help; I'll keep googling but suggestions are appreciated.http://ant.apache.org/
~ -
Making clickable links in GUI?
Hi,
Well, I'm making an GUI application and I wanted to have a clickable link to my website, I thought using HTML would be a good bet, but it doesn't work, I was thinking of using util but I'm not exactly sure..Swing related questions should be posted in the Swing forum.
JEditorPane provide some basic support for loading HTML pages. Read the API for more info.
You can invoke IE as follows:
** Here is a pure Windows solution
** Run the code and you will be taken to a tutorial that may provide
** a more generic solution
public class WindowsFileProtocolHandler
public static void main(String[] args)
throws Exception
String[] cmd = new String[4];
cmd[0] = "cmd.exe";
cmd[1] = "/C";
cmd[2] = "start";
cmd[3] = "http://www.javaworld.com/javaworld/javatips/jw-javatip66.html";
// cmd[3] = "will.xls";
// cmd[3] = "mailto:";
// cmd[3] = "a.html";
// cmd[3] = "file:/c:/java/temp/a.html";
Process process = Runtime.getRuntime().exec( cmd );
} -
Im trying to link the output text terminals contents to be displayed within the gui, is using a JtextArea the correct way to do this, and also is there a shortcut such as copying the contents straight into the gui window? ive checked the APi but have either overlooked or cant find an item to do this.
thanks!If I understand you, there is no shot cut to using setText or append. One
handy method that is often overlooked is
read(Reader , Object )
Which would help copy from a file, but not from the console, unless stdin is
being redirected from a file :-) -
Linking a Java class to a Swing GUI...
Well I've got a class for running a text based interface for a simple queue system. All I need to do is link it to the GUI i have designed. Below is the code for both. Anyone that can give me code to link the classes between them (I'm going to change the uuInOut statements to .getText() where relevant).
Thanks for the help. My bloodpressure and stress levels need it.
import uuInOut;
class Queue
QueueNode start;
QueueNode end;
public int totalSize = 0;
public int choice;
public String yesNo;
public Queue()
start = new QueueNode();
start = null;
end = new QueueNode();
end = null;
public void add()
if (start==null)
start = new QueueNode();
System.out.print("\nPlease enter your username: ");
start.owner = uuInOut.ReadString();
System.out.print("\nPlease enter the name of the document:");
start.name = uuInOut.ReadString();
System.out.print("\nPlease enter the size of the document(in kilbytes):");
start.size = uuInOut.ReadInt();
totalSize = totalSize + start.size;
start.next = null;
start.previous = null;
end = start;
else
QueueNode temp = new QueueNode();
System.out.print("\nPlease enter your username: ");
temp.owner = uuInOut.ReadString();
System.out.print("\nPlease enter the name of the document:");
temp.name = uuInOut.ReadString();
System.out.print("\nPlease enter the size of the document(in kilobytes):");
temp.size = uuInOut.ReadInt();
totalSize = totalSize + temp.size;
temp.next = end;
end.previous = temp;
end = temp;
public boolean isEmpty()
return (start==null);
public void remove()
String name2;
QueueNode before = new QueueNode();
QueueNode after = new QueueNode();
QueueNode temp = new QueueNode();
if (this.isEmpty())
System.out.println("Error there are no documents in the queue.");
else
do
System.out.println("Which document do you wish to remove: ");
name2 = uuInOut.ReadString();
while(temp.name!=name2)
before = temp.previous;
after = temp.next;
temp.next = after;
temp.previous = before;
temp = before;
System.out.println("\nThe document has been removed");
System.out.print("\nDo you wish to remove another document: ");
yesNo = uuInOut.ReadString();
}while(this.yesNo.equalsIgnoreCase("y"));
public void displayAll()
if (this.isEmpty())
System.out.println("\nThere are no documents to display.");
else
System.out.println("User\t\tDoc Name\t\tSize\n");
QueueNode temp = new QueueNode();
temp = start;
while (temp!=null)
System.out.println(temp.owner+"\t\t"+temp.name+"\t\t\t"+temp.size);
temp = temp.previous;
public int getSize()
return totalSize;
public void purge()
if (this.isEmpty())
System.out.println("\nThere are no documents in the queue.");
else
start = new QueueNode();
start = null;
end = new QueueNode();
end = null;
totalSize = 0;
System.out.println("The queue is now empty.");
public void displayMenu()
System.out.println("\n\t\tMain Menu");
System.out.println("\n\t1.\tAdd a document to the Queue");
System.out.println("\t2.\tRemove a document from the Queue");
System.out.println("\t3.\tDisplay all documents in the Queue");
System.out.println("\t4.\tDisplay the total size of the Queue");
System.out.println("\t5.\tPrint a document");
System.out.println("\t6.\tPurge all documents from the Queue");
System.out.println("\n\t8.\tExit Program");
System.out.flush();
public void print(String name2)
if(this.isEmpty())
System.out.println("\nThere are no documents to print.");
else
System.out.println("Printed");
Here's the code for the GUI (there seems to be a problem with it which I cant seem to figure out)
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
import Queue.*;
import QueueNode;
public class PrinterQueueInterface extends JFrame implements ActionListener
JLabel nameLabel, userLabel, sizeLabel, numberLabel, totalLabel;
JTextField nameBox, userBox, sizeBox, numberBox, totalBox;
JButton addButton, removeButton, printButton, purgeButton, exitButton;
public PrinterQueueInterface()
super("Queue System");
setSize(350,360);
setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
nameLabel = new JLabel("Name:");
userLabel = new JLabel("User:");
sizeLabel = new JLabel("Size:");
numberLabel = new JLabel("No. Of Items in Queue:");
totalLabel = new JLabel("Total Size of the Queue:");
nameBox = new JTextField(15);
userBox = new JTextField(15);
sizeBox = new JTextField(5);
numberBox = new JTextField(3);
totalBox = new JTextField(15);
addButton = new JButton("Add Document");
removeButton = new JButton("Remove Document");
printButton = new JButton("Print Document");
purgeButton = new JButton("Purge the Queue");
exitButton = new JButton("Exit");
JPanel pane = new JPanel();
setContentPane(pane);
show();
Container contentPane = getContentPane();
contentPane.setLayout(new GridLayout(0,2));
setLayout(new BoxLayout(this,BoxLayout.Y_AXIS));
contentPane.add(nameLabel);
contentPane.add(nameBox);
contentPane.add(userLabel);
contentPane.add(userBox);
contentPane.add(sizeLabel);
contentPane.add(sizeBox);
contentPane.add(numberLabel);
contentPane.add(numberBox);
contentPane.add(totalLabel);
contentPane.add(totalBox);
setLayout(new BoxLayout(this,BoxLayout.Y_AXIS));
contentPane.add(addButton);
contentPane.add(removeButton);
contentPane.add(printButton);
contentPane.add(purgeButton);
contentPane.add(exitButton);
addButton.setLocation(50,100);
removeButton.setLocation(10, 100);
printButton.setLocation(20,100);
purgeButton.setLocation(30,100);
exitButton.setLocation(40,100);
addButton.addActionListener(this);
removeButton.addActionListener(this);
printButton.addActionListener(this);
purgeButton.addActionListener(this);
exitButton.addActionListener(this);
public void actionPerformed(ActionEvent evt)
Object source = evt.getSource();
if (source==exitButton)
System.exit(0);
else if (source==clearButton)
nameBox.setText("");
userBox.setText("");
else
public String docName = nameBox.getText();
public String userName = userBox.getText();
public String docSize = sizeBox.getText.toInt();
if (source==addButton)
Queue.add(docName, userName, docSize);
else if (source==removeButton)
Queue.remove(docName, userName, docSize);
else if (source==printButton)
Queue.print();
else if (source==purgeButton)
Queue.purge();
public void main(String[] args)
new PrinterQueueInterface();
}It is simple and very annoying.
I think you should try to do it yourself to learn how Java works, it is a good exercise for you.
The forum is used to work together on different problems, giving tips and ideas but not coding for other people.
About your problem, two things : you should rewrite all the code (not trying to link these two classes) and you will have serious problems wityh the different setLayout you use !
Denis -
Saving to text file from GUI within linked list
can anyone help me with saving to a text file from a GUI text area and text fields??
then reading back into the labels and textfields from the text file??
It's currently just saving in a linked list and creating a new item inside of it. but i have to now make a text file for each item, this is what i currently have
i need to turn this into something that with save to text file with buffered reader or something, can anyone help???
public void saveToFile()
while(listIterator.hasNext())
item = (Item)listIterator.next();
saving.save(item);
}//END SAVETOFILE
public Object save(Item item)
if (last == 1)
itemList.set( listIterator.nextIndex() , item);
else
itemList.set(listIterator.previousIndex(), item);
itemList.set(listIterator.previousIndex(), item);
listIterator = itemList.listIterator(0);
return itemList.getFirst();
}//END SAVEthank you sztyopek, i am still having trouble getting it to save to text file. I have to do it through a client and server so i have a protocol class. in the protocol class i have
if (o instanceof String)
//System.out.println(o);
if (o.equals("next"))
newo = database.getNextItem();
// some how send newo
if (o.equals("prev"))
newo = database.getPrevItem();
//some how send newo
if (o.equals("save"))
database.saveToFile();
if (o.equals("exit"))
System.exit(1);
}//END IF STRING
if (o instanceof Item)
newo = database.save((Item)o);
return newo;
}When i save what i have entered in the textfields for each record it doesn't create a textfile. and it still getting retrieved from how i set it up before by going to the database.save((Item)o)...the last if statement above but i can't change that to the saveToFile method that u helped me with it says incompatible types or something.
this is the method it is going to, i assume i have to get rid of this so i stop getting the information from the list and start getting it from the text file.
public Object save(Item item)
if (last == 1)
itemList.set( listIterator.nextIndex() , item);
else
itemList.set(listIterator.previousIndex(), item);
itemList.set(listIterator.previousIndex(), item);
listIterator = itemList.listIterator(0);
return itemList.getFirst();
}//END SAVEif this makes any sense can u give me a hand.
As to rob the guy bagging me........i am doing a bachelor of networking and they make us do java for the first year. this is my last semester and last assignment. it is also the last thing i have to do for the assignment. I am not good at java so that is why i am asking for some help i just want to pass this semester then i am never doing it again.
thanks. -
Hi.... All..
Please help me out i want to download SAP-gui for windows-07.. give me the link where i can download SAP-gui (free).
thanks n regards.Sandeep ..pls check the link below.
http://www.sdn.sap.com/irj/sdn/sap-gui#section6
Regards,
Guru -
my mysql server is up and running and my connection code is correct because am not getting any error. so how shuold i link the two search that i enter info from the GUI i have created and its saved to my database. i,d really appreciate help from anyone.
what kind of gui? swing or web?
% -
I have been set an assignment to connect a java program to an oracle database. I wanted to put a GUI interface on top of the program. I was wondering how you can connect the GUI together for example on my code i have a read in from database button and when it is pressed i want it to read in data from the database and then i want it to go to a separate GUI that can display the data. How would i display the data would it have to be put into a large text box or is there a more appropriate way of doing this. Also how would i simply link two GUI interfaces together so that when one is pressed with for example a button to say to next it would go to another menu. Sorry if this is very wordy. I'm not sure if you would just use a extends or something like that.
import javax.swing.*;
import java.awt.*;
import java.awt.event.*;
public class LeagueGUI extends JFrame implements ActionListener{
private JPanel pnlPanel;
private JButton btnRead, btnUpdate, btnReadDatabase, btnDisplayUpdated;
private JFrame frmFrame;
private JLabel lblpicture;
public LeagueGUI(){
setTitle("League Table");
setSize(900,600);
pnlPanel = new JPanel();
pnlPanel.setLayout(null);
pnlPanel.setBackground(Color.blue);
ImageIcon LeagueGUI = new ImageIcon("Premier.jpg");
lblpicture = new JLabel(LeagueGUI);
lblpicture.setBounds(430, 10, 100, 500);
pnlPanel.add(lblpicture);
btnRead = new JButton("Match Results");
btnRead.setBounds(50, 450, 200, 100);
btnRead.addActionListener(this);
pnlPanel.add(btnRead);
btnUpdate = new JButton("Update");
btnUpdate.setBounds(250, 450, 200, 100);
btnUpdate.addActionListener(this);
pnlPanel.add(btnUpdate);
btnReadDatabase = new JButton("Read Database");
btnReadDatabase.setBounds(450, 450, 200, 100);
btnReadDatabase.addActionListener(this);
pnlPanel.add(btnReadDatabase);
btnDisplayUpdated = new JButton("Display Updated");
btnDisplayUpdated.setBounds(650, 450, 200, 100);
btnDisplayUpdated.addActionListener(this);
pnlPanel.add(btnDisplayUpdated);
getContentPane().add(pnlPanel);
setVisible(true);
public void actionPerformed(ActionEvent event) {
Object source = event.getSource();
if (source == btnRead) {
else if (source == btnUpdate) {
public static void main(String[] args) {
LeagueGUI League = new LeagueGUI();
}thank you in advance for your help please let me know if u need more specific information.if i were doing this i would first write a bunch of functions that will handle connecting to the database and getting back the values formatted the way you will want them displayed.
after that i would start working on the GUI and linking it all together. you can easily add listeners to buttons (and other things) that can detect when they have been clicked -- once you detect the click you can call any functions / do anything you'd like (in this case you would call the database code you wrote).
if you google around you should be able to find some basic JDBC examples of java connecting to oracle databases.
let me know if you need anything else.
Maybe you are looking for
-
This just started recently, since installing firefox 4. Now whenever I search on google or other search engines, when I click on a result, I am automatically redirected to another search site. Any ideas?
-
Drag and drop multiple mail messages into a folder in finder
Hello All, I want to archive emails into folders in the finder. I can do this by dragging and dropping individual emails but not bulk emails. Does anywone know the best way of doing this? The reason I want to do it is once we have compleated a contra
-
Software install date is incorrect in SCCM report
Both tables "v_GS_INSTALLED_SOFTWARE_CATEGORIZED" and "v_Add_Remove_Programs" (InstallDate0) are showing when a patch was last installed instead of showing the initial installation date for the software. For instance, even on my machine, the control
-
Page flow . . .
I have an extensive spreadsheet with Numbers. When printing, if the second row on a given page is too long to fit entirely on that page the entire row is forced to the next page (much like widow or orphan control in a word processor). What I would ra
-
Hi, Initially we deployed VSM on a VM and that was working fine. Now the customer has bought a 1010 appliance and wants us to configure VSMs on the 1010 appliance. I just want to confirm that the steps that I can up with after going through cisco doc