Opening new forms using jbutton
Hi i'm new to java, and i am currentley building an interface which has three buttons(cars,vans,red car). I have managed to create a class that opens a new window when the car button is clicked. However i am unsure of how to create different windows for when the other buttons are clicked.
Heres my code ive based it on an example i found on here.
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
import java.awt.*;
import javax.swing.JFrame;
import javax.swing.JPanel;
import javax.swing.JScrollPane;
import javax.swing.JTable;
import java.awt.Dimension;
import java.awt.GridLayout;
public class Interface extends JPanel implements ActionListener {
JDialog dialog;
public Interface(JFrame f)
dialog = new JDialog(f, "dialog");
dialog.getContentPane().add(new JLabel("hello world", JLabel.CENTER));
dialog.setSize(400,300);
dialog.setLocation(425,200);
public void actionPerformed(ActionEvent e)
if(!dialog.isVisible())
dialog.setVisible(true);
else
dialog.toFront();
public JPanel getPanel()
JPanel panel = new JPanel();
JPanel selectPanel = new JPanel();
JPanel ControlPanel = new JPanel();
selectPanel.setBorder(BorderFactory.createCompoundBorder(
BorderFactory.createTitledBorder("Select Piece Type:"),
BorderFactory.createEmptyBorder(5,5,5,5)));
JButton cars = new JButton("Cars");
cars.addActionListener(this);
JButton vans = new JButton("Vans");
JButton redcar = new JButton("Red Car");
selectPanel.add(cars);
selectPanel.add(vans);
selectPanel.add(redcar);
panel.add(selectPanel);
return panel;
public static void main(String[] args)
JFrame f = new JFrame();
Interface ae = new Interface(f);
f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
f.getContentPane().add(ae.getPanel(), "North");
f.setSize(400,200);
f.setLocation(200,200);
f.setVisible(true);
Thanks for any help
Thanks for the reply, i am now having trouble adding buttons to the dialog box. This is the code i am using:
dialog = new JDialog(f, "dialog");
dialog.getContentPane().add(new JLabel("hello world", JLabel.CENTER));
dialog.setSize(400,300);
dialog.setLocation(425,200);
JButton buttonQuestion = new JButton( "Question" );
dialog.getContentPane().add(buttonQuestion);For some reasson this turns the whole dialog pane into a button. So all i get is a dialog box with question in the middle. What i need is the hello world label to be displayed, with the questin button underneath
Thanks for any help
Similar Messages
-
I am trying to add a new workflow to a document library with the below mentioned settings and getting error saying "This form cannot be opened in a web browser. to open this form use microsoft infopath" while adding a new Approval - Sharepoint
2010 and Publishing Approval workflow" . For your information the I have checked the server default option to open in browser.
Versioning Settings.
Error
This is quiet urgent issue . Any help would be really helpful.. Thanks..Hi Marlene,
Thank you very much for your suggestions.
But I am not creating a custom workflow in designer as Laura has mentioned. I am instead trying to create a new Out of the box Approval Workflow and I get the error mentioned above.
As it works in other environment, I tried figuring out the possible differences which can lead to this error.
Today I found one difference which is there are no form Templates within Infopath Configurations in Central Admin. Now I am trying to figure out what makes this form templates to be added to the template gallery.
Regards,
Vineeth -
Error opening new form via Call_form
I wrote a forms that captures error code from the calling forms and shows message_text, cause and action for that error.
When calling form causes a ORA-00054 error (lock record), I cannot call the form that displays because focus is not passed to called form.
What can I do? I need to call this form to show message_text, cause and action.Hi Archana,
There are many ways to pass values between forms.
1. You define a global variable before issuing a call/open/new form and use the value in the called/opened form.
2. Create a database package spec and define variables there. Use them to set values and read from other forms.
3. Create a parameter list and pass the list to the call/open/new form built-in and read from there.
If you explain your usecase more, we can suggest you a good way to implement it.
-Arun -
Hi,
After opening new form in separete module,
I want to pass the values of one form to another form , through a global variable.
Help me.
Archana V.
Edited by: Archana V on Dec 28, 2009 10:11 AMHi Archana,
There are many ways to pass values between forms.
1. You define a global variable before issuing a call/open/new form and use the value in the called/opened form.
2. Create a database package spec and define variables there. Use them to set values and read from other forms.
3. Create a parameter list and pass the list to the call/open/new form built-in and read from there.
If you explain your usecase more, we can suggest you a good way to implement it.
-Arun -
Dear all.
How can i open new FORM, when i double click at (tree) node.
Best Regards
node
|__node1
|__node11 <-- double click and open new FORM
|__node12
|__node2
|__node21
Message was edited by:
First_StepWhe-tree-node-activated trigger
declare
pl_id paramlist;
value1 varchar2(100) ;
begin
-- Checks whether the trigger node is a leaf not or not if yes
-- Call the Corresponding form else do nothing
if (Ftree.Get_Tree_Node_Property('tree_block.tree1', :SYSTEM.TRIGGER_NODE, Ftree.NODE_STATE)= 0) THEN
--CREATE PARAM LIST FOR CALL_FORM
pl_id:=get_parameter_list('userparam');
if(id_null(pl_id)) then
pl_id:=create_parameter_list('userparam');
else
destroy_parameter_list(pl_id);
pl_id:=create_parameter_list('userparam');
end if;
--ADD NEEDED PARAMETERS
add_parameter(pl_id,'user_name',text_parameter,:parameter.user_name);
--HERE NODE VALUE IS FORM NAME
value1:=Ftree.get_tree_node_property('tree_block.tree1', :system.trigger_node,ftree.node_value);
call_form(value1,hide,no_replace,no_query_only,pl_id);
END IF;
end;
jeneesh -
When opening new tab, using ctrl, moving directly to the next tab
when i open new tab using ctrl+left click it moving directly to the next tab, but i check the option menu then tab section, all sentence has a tick except the fifth one
i can't remove this to the origin, and i uninstall firefox and reinstall it many timeTab mix plus https://addons.mozilla.org/en-US/firefox/addon/tab-mix-plus/
also solves that problem, it has the option to focus the search box. -
Opening a new form using a different connect string
Hi All
I have the following requirement. I want to open an new form (when button pressed) using a different connect string. I am planning to use open form so that the new form has its own session. But I donot want the new form to connect to the same database. How do I pass the database that I want to connect using open form.
Rgds
Arvind BalaramanThe only way to change the connection is to execute the built-in LOGIN and connect to the desired database. You cannot pass this through the OPEN_FORM built-in.
Example:
LOGOUT;
LOGON(uname, upass || '@' || conn_str);
However, be aware that this will impact the first form too. This is expected behavior.
See Oracle Bug 5004661 or the Forms Online Help for more details.
http://www.oracle.com/webapps/online-help/forms/10g/state?navSetId=_&navId=3&vtTopicFile=designing_forms/multform_db/at0505.html -
How to open new form with set value
I have two forms CLIENT and ORDERS who are connected by "client_id" in a one to many relationship [one client can have many orders]. What code to I put in the button so that that when I click on it from the CLIENT table, it goes to the ORDERS form with just the orders that match that "client_id"? The application is in oracle 9i developer using swing.
Here's what I have so far, code to open the form without the binding
//Open Order Form
FormIcdClientApplicationView frameTarget = new FormOrderApplicationView(getPanelBinding());
frameTarget.setVisible(true);
// Close this window
this.setVisible(false);Hello,
This is the Forms forum. I am sure you will have more chance to get answer in the JDeveloper forum.
FRancois -
Launching a new form using web.show_document
Using 9iAS 9.0.2.1.1. and Forms9i I'm trying to get a form to launch a new browser window and open a new form in it. At present I'm using web.show_document to do this. However, I get an error message stating that 'Connection from new browser window is not supported'. From an earlier thread in this forum I found a possible solution which is to set the session.useCookies to false in the zone.properties, which I have done, but I'm still getting the same error. I've tried restarting the OC4J_BI_Forms OC4J and the HTTP server, but nothing makes any difference. Am I missing something?
If you are attempting to print a report from a when-button-pressed trigger from within a form, you do not have to explicitly specify the server (hostname) nor the port. You can just use what I've found referred to as a virtual path to the server as I have done here:
parm_string := '/reports/rwservlet?config=my_config&report=report_name'
||'&desformat=pdf&destype=cache'
||'¶mform=no&printjob=no'
||'&p_my_user_param1='||v_my_param1
||'&p_my_user_param2='||v_my_param2;
web.show_document(parm_string,'_blank');
You can specify a userid/password@connectstring within a named congifuration section of your formsweb.cfg file if necessary, e.g. my_config.
Hope this helps.
James K. -
have recently downloaded the newest version of firefox. after installing i am happy to say i am pleased with the new look and features etc though for some reason i am unable to open new tabs as before.
i now have to right click on bookmarks or favorites and select open in a new tab to do so, rather than simply clicking on the new tab button..If the problem turns out to be the "New Tabs at the End" extension, there actually is an internal setting for this that you could use instead.
(1) In a new tab, type or paste '''about:config''' in the address bar and press Enter. Click the button promising to be careful.
(2) In the search box above the list, type or paste '''tabs''' and pause while the list is filtered
(3) Double-click the '''browser.tabs.insertRelatedAfterCurrent''' preference to switch it from true to false. That's it. -
The error when post a New Form use sap demo news
Hi all!
When I post a newform use the SAP Demo News form, I found the text(Title,Date,etc) on the post page is not found.and when I saved,The news text can't display.
The trace file display:
#1.5 #00145ED2F356006D0000021D000670C200047D17ADB8AB81#1263440559123#System.err#sap.com/irj#System.err#index_service#275030##DSAPBPRD_DPP_15757350#index_service#dc9235c000be11df9e9600145ed2f356#SAPEngine_Application_Thread[impl:3]_0##0#0#Error##Plain###Exception while loading External XMLSource in 'document': javax.xml.transform.TransformerException: Error downloading from URL: wcm://XFBuilderConfig/Global-ResourceFile__en.xml, Invalid RID: No repository manager found for prefix: /XFBuilderConfig#
#1.5 #00145ED2F356006D0000021E000670C200047D17ADB8AD1D#1263440559123#System.err#sap.com/irj#System.err#index_service#275030##DSAPBPRD_DPP_15757350#index_service#dc9235c000be11df9e9600145ed2f356#SAPEngine_Application_Thread[impl:3]_0##0#0#Error##Plain###Exception while loading External XMLSource in 'document': javax.xml.transform.TransformerException: Error downloading from URL: wcm://SAP_DemoNews/SAP_DemoNews__en.xml, Invalid RID: No repository manager found for prefix: /SAP_DemoNews#Hi.
Check SAP Note 1007805.
Best regards,
Aliaksandr Zhukau -
Midlet Application : opening new form
Hello,
I want to create a midlet aplication. I am using Sun's wireless toolkit. in the application, the user is presented. with the uname and psswd textbox. on successful login, after displaying the alert, I want to show another form, where the user can input some data, and then saves the form. How can display some different form from this midlet app. suggest please. below is my code.
the function doLogin verifies the user authentication.
import javax.microedition.midlet.MIDlet;
import javax.microedition.lcdui.*;
public class UserLogin extends MIDlet implements CommandListener
private Display display;
private TextField userName,password;
public Form form;
private Command login,cancel;
private Image img, imge, img2;
public UserLogin() {
form = new Form("Sign in");
userName = new TextField("LoginID:", "", 30, TextField.ANY);
password = new TextField("Password:", "", 30, TextField.PASSWORD);
cancel = new Command("Cancel", Command.CANCEL, 2);
login = new Command("Login", Command.OK, 2);
try{
img = Image.createImage("/logo.png");
imge = Image.createImage("/front_left1_bad.png");
img2 = Image.createImage("/Congratulations-1.png");
}catch(Exception e){
System.out.println(e.getMessage());
public void startApp() {
display = Display.getDisplay(this);
try{form.append(img);}catch(Exception e){}
form.append(userName);
form.append(password);
form.addCommand(cancel);
form.addCommand(login);
form.setCommandListener(this);
display.setCurrent(form);
public void pauseApp() {}
public void destroyApp(boolean unconditional) {
notifyDestroyed();
public void validateUser(String name, String password)
String result = DoLogin.doLogin(name,password);
System.out.println("THE RESULT IS:"+result);
if(result.equals("T"))
showMsg();
else if(result.equals("F"))
tryAgain();
public void showMsg() {
Alert success = new Alert("Login Successfully", "Your Login Process is completed!", img2, AlertType.INFO);
success.setImage(img2);
userName.setString("");
password.setString("");
display.setCurrent(success, form);
public void tryAgain() {
Alert error = new Alert("Login Incorrect", "Please try again", imge, AlertType.ERROR);
error.setTimeout(900);
error.setImage(imge);
userName.setString("");
password.setString("");
display.setCurrent(error, form);
public void commandAction(Command c, Displayable d) {
String label = c.getLabel();
if(label.equals("Cancel")) {
destroyApp(true);
} else if(label.equals("Login")) {
validateUser(userName.getString(), password.getString());
}Hello,
First of all thanks for the reply. Is there any IDE to write the midlet application which like highlights the keywords and shows format etc. I am using wordpad and Sun's WTK, as I am new to midlet development its a bit hard to find the mistakes using those.
Once again, If in a form I want to generate variable number of textboxes based on a database reply How should I do it, I did the following but it didnt work. It didn't also added the command buttons to the new screen. I bolded the part didnt work in my code.
public void showMsg() {
Alert success = new Alert("Login Successfully", "Your Login Process is completed!", img2, AlertType.INFO);
success.setImage(img2);
addCform = new Form("Add Concern");
userName.setString("");
password.setString("");
display.setCurrent(success, addCform);
title = new TextField("Title:", "", 10, TextField.ANY);
desc = new TextField("Description:", "", 30, TextField.ANY);
addCform.append(title);
addCform.append(desc);
*cancelC = new Command("Cancel", Command.CANCEL, 2);*
* save = new Command("Save", Command.OK, 2);*
* form.addCommand(cancelC);*
* form.addCommand(save);*
*for(int i=0;i<5;i++)*
* txtbox= new TextField("Text","",10,TextField.ANY);*
* addCform.append(txtbox[i]);* -
Clonned server did not open new form after login
Hi experts,
After login sucessfuly, when click any form, it did not open any new form and not return any form. Can you please
help me in this case.
ThanksPlease check whether you have any errors in the database log file or not.
I could not find any error regarding the issue. Please give me step by step if you can assist to sort out
the issue. I have no much experience regarding such issue. So I need more clearance and step by step instructions.Please rename Apache log files, restart the services, then reproduce the issue and check the log files.
Also, please check if you have any errors in Jinitiator/JRE console window.
Thanks,
Hussein -
Creating new forms using a button
I am trying to make a button that creates a new form which in turn creates another form etc. any suggestions
You could just create an new instance of a Form in the click event handler for a Button and display it by calling its Show method:
Form1:
private void button1_Click(object sender, EventArgs e)
Form2 frm2 = new Form2();
frm2.Show();
The constructor of the second form can then display another form:
Form2:
public partial class Form2 : Form
public Form2()
InitializeComponent();
Form3 frm3 = new Form3();
frm3.Show();
Please remember to mark helpful posts as answer to close your threads and then start a new thread if you have a new question. Please don't ask several questions in the same thread. -
Adobe X pro, export forms data to fdf, then import into new form using automation?
Is there a faster way to export 13 page forms pdf data out to fdf and then import I back into a new pdf form. There are a total of 167 pdf files with total of 130 some field on each form. The fields are all the same in each document. I want to make a macro or script to automate this process. I don’t want to to open all 167 files then export them one at a time. then creat167 new files and import all that data back in. Also each file is the name of the person who filled it out. I could automate the copying of the new 2012 pdf to make 167 new ones each with their name using VBA. But if that could be automated in adobe great.
We have to make new admission forms for next year. Currently all the dates and fees are this year. So I had to update all the pages in Publisher and reprint them to pdf. We are sending the forms back to people with the data already entered since 95% of it did not change. This helps save them time in having to re-fill out the entire form again.
Or any other suggestions
TIAtry67, I do have Pro as stated in the title “Adobe X pro, …”
George,
the position of the forms fields is exactly the same. But now that I think of it the data in the pdf’s is slightly older than the exported info in Access as I explain further below.
George, I can create 167 files in an instant using VBA, I in fact have all the names in Access and did this already.
I also forgot, I have all the data from all the forms in Access now. So it would be better to use that since it is more up to date than the pdf forms. Any email and phone number changes were changed in Access. I clicked Manage Form data/ export to txt in Adobe and imported that into Access with a VBA and a macro.
So I really just need to open each particular file and import the data into it.
So can I call the whole process from VBA? Using a Active-X reference in VBA to get to control Adobe?
I write VBA in my sleep so if it can be done there, Fantastic.
Maybe you are looking for
-
Error message "Cant open illustration" in Illustrator CC 2014 on Win 7 PC
Need urgent help to recover or open file, please.
-
My 17" MBP shipped today and is due to be delivered to me in the UK on or before 12 May. Nice! Anyone else's shipped yet? Awaiting MBP 17", 2.16 Ghz, 7200 Rpm, 100G HD, 1G RAM Mac OS X (10.4.6)
-
Copying selection criteria in XLR advance report builder
Can anyone tell me if it is possible to copy columns, rows or cells in the XL Reporter advance designer and copy the selection criteria as well? Thanks
-
Opening pages in new tab from Bookmark Folder
From my Bookmark bar, I can open up a bookmark in a new tab by Cmd-clicking on it--just like any ol' regular link. But when the bookmark is in a folder, Cmd-clicking opens up in the current tab. I'd like it to open in a new tab. Am I doing something
-
"IMAQ Stop" takes 10sec to execute and consumes 100% CPU
Hi, I'm calling IMAQ Stop to end an acquisition but it consumes 100% of my processor and takes 10sec to complete (all the while consuming 100% CPU). In our application we start and stop the camera regularly and this is exactly when the user wants th