How to add one component when some action take place
Hi,
i created a GUI using Netbeans Ide, In that i want add a component when i click some button
i showed it here see the diagram
[click here to see|http://www.mediafire.com/imageview.php?quickkey=jtgzjrfenwm]
my sample code
public class ProcessFiles1 extends javax.swing.JFrame implements ActionListener,
PropertyChangeListener{
private JProgressBar progressBar;
/ Creates new form ProcessFiles1 */*
* public ProcessFiles1() {*
* initComponents();*
* /** This method is called from within the constructor to
*initialize the form.*
WARNING: Do NOT modify this code. The content of this method is
*always regenerated by the Form Editor.*
@SuppressWarnings("unchecked")
// <editor-fold defaultstate="collapsed" desc="Generated Code">
private void initComponents() {====================================>here i am not adding Progress bar
to GUI
jToggleButton1 = new javax.swing.JToggleButton();
jToggleButton2 = new javax.swing.JToggleButton();
jComboBox1 = new javax.swing.JComboBox();
jLabel1 = new javax.swing.JLabel();
jLabel2 = new javax.swing.JLabel();
jComboBox2 = new javax.swing.JComboBox();
jScrollPane1 = new javax.swing.JScrollPane();
jTextArea1 = new javax.swing.JTextArea();
setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
setTitle("Admin@localhost");
setIconImage(Toolkit.getDefaultToolkit().getImage("c:\\Logo.PNG"));
jToggleButton1.setText("Select File");
jToggleButton1.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
FileChooser(evt);
jToggleButton2.setText("Run Files");
jToggleButton2.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
addComp(evt);
jComboBox1.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "Item 1", "Item 2", "Item 3", "Item 4" }));
jComboBox1.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jComboBox1ActionPerformed(evt);
jLabel1.setText("Success");
jLabel2.setText("Faild");
progressBar = new JProgressBar(0, 100);
progressBar.setValue(0);
progressBar.setStringPainted(true);
jComboBox2.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "Item 1", "Item 2", "Item 3", "Item 4" }));
jTextArea1.setColumns(20);
jTextArea1.setEditable(false);
jTextArea1.setRows(5);
jScrollPane1.setViewportView(jTextArea1);
javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());=================>from here i am adding components
getContentPane().setLayout(layout);
layout.setHorizontalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addGap(26, 26, 26)
.addComponent(jScrollPane1, javax.swing.GroupLayout.PREFERRED_SIZE, 965, javax.swing.GroupLayout.PREFERRED_SIZE))
.addGroup(layout.createSequentialGroup()
.addContainerGap()
.addComponent(jToggleButton1)
.addGap(18, 18, 18)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jToggleButton2)
.addGroup(layout.createSequentialGroup()
.addComponent(jLabel1)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
.addComponent(jComboBox1, javax.swing.GroupLayout.PREFERRED_SIZE, 155, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGap(32, 32, 32)
.addComponent(jLabel2)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(jComboBox2, javax.swing.GroupLayout.PREFERRED_SIZE, 151, javax.swing.GroupLayout.PREFERRED_SIZE)))))
.addContainerGap(29, Short.MAX_VALUE))
layout.setVerticalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addContainerGap()
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(jToggleButton1)
.addComponent(jComboBox1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(jLabel1)
.addComponent(jLabel2)
.addComponent(jComboBox2, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
.addGap(26, 26, 26)
.addComponent(jToggleButton2)
.addGap(18, 18, 18)
.addComponent(jScrollPane1, javax.swing.GroupLayout.PREFERRED_SIZE, 583, javax.swing.GroupLayout.PREFERRED_SIZE)
.addContainerGap(20, Short.MAX_VALUE))
pack();
}// </editor-fold>
private void addComp(java.awt.event.ActionEvent evt)---------------------------------------->when 'runfile' button clicked i am
trying to add progressbar component it is not adding
layout.addLayoutComponent("Progress", progressBar);
pack();
}how can i add progressbar when runfile button clicked
please any one focus some light on this
Thanks in advance,
Nagaraju.
Edited by: uppala on Dec 18, 2009 11:33 AM
Well, normally the code would be:
panel.add( someComponent );
panel.revalidate();But since you are using the IDE to generate your code you need to learn and understand how to use the GroupLayout and all its constraints to add the component.
My advice is to get rid of the IDE generate code and create the GUI yourself.
Similar Messages
-
How To add One component to a TabbedPane
Hi,
I have a TabbedPane with four tabs in it
the tabs are created dynamically it may be four or five
i want to add only one component to it i.e JTable
if i just add a component to the tabpan like below
tabpane is an instance of JTabbedPane
tableofvalues is an instance of JTable
tabpane.add(tableofvalues); this code creates a
default tab and add the component
but i dont want the default tab i just want only the component
can somebody please give me a solution for this
give me the overiding function alsoi need to add one component which is common to all the tabs You can't. A component can only be added to a single container.
However you might be able to share a model. For example:
JTextField forTab1 = new JTextField("some data");
JTextField forTab2 = new JTextField( forTab1.getDocument() ); -
How to add one item when another item get added into the iProcurement Cart
Hi,
Please help me to do the following customization in iProcurement Cart:
Requirement-1:
1. Login to iProcurement and add one Item ITEM1 to Cart.
2. Make another Item ITEM2 mandatory or get added automatically when Item ITEM1 gets added into the iProcurement Cart
OR
Requirement-2:
1. Login to iProcurement and add one Item ITEM1 to Cart.
2. Go to Cart and click Checkout.
3. While checking out Item ITEM1, we need some validation to make another Item ITEM2 mandatory or get added automatically with Item ITEM1.
Thanks in Advance,
SBHi tiff512:
The way is:
SAP NetWeaver > General Settings > Check Units of Measurement.
The help documentation says the following in relation to the creation of new units of measure:
"If required, define new units of measurement according to the international system of units (SI) with the menu function Unit of meaurement -> Create.
Here you have to make make specifications for:
Display (including a descriptive Units of measurement text)
Conversion (not applicable to units of measurement without dimensions)
Data exchange (EDI) (optional)
Application parameters"
I hope it is helpful to you.
Regards,
David -
XSLT Mapping: how to add one day to TimeStamp
Hello Experts,
My requirement is to add one day to current timestamp. Used $TimeSent to get the currenttimestamp. In Expired field, the need to add one day
say Created= 2011-03-30T20:29:13Z
Expired = 2011-03-31T20:29:13Z
<xsl:param name="TimeSent"/>
<created><xsl:value-of select="$TimeSent"/></created>
<expired>2011-03-31T20:29:13Z</expired>
How to add one day to the current timestamp. I am new to XSLT mapping and need some help with the code.
Thanks
Shikha Jain
Edited by: Jain Shikha on Mar 30, 2011 8:34 PM
Edited by: Jain Shikha on Mar 30, 2011 8:36 PMHello All,
Thanks for your reply. i tried the function and the code is working when i am testing in stylus studio. But the same code gives error when i tested the xslt mapping in PI (Error: TransformerConfigurationException triggered while loading XSLT mapping).
$TimeSent function is working when code is tested in PI , but it doesnot give value in stylus studio. Also Current-dateTime() function is doesnot give value in PI but works in stylus studio. Is there any difference in the functions used in stylus studio and XSLT mapping in PI?
Also if i remove the code used for function(to add one day to timestamp), and use constant value(2011-04-02T23:24:56.763Z)the code is working fine in PI. Please help me to find out where the code is going wrong when tested in PI.
Below is the XSLT code i am using
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:ds="http://xsltsl.org/date-time" xmlns:functx="http://www.functx.com" xmlns:xs="http://www.w3.org/2001/XMLSchema">
<xsl:function name="functx:next-day" as="xs:date?">
<xsl:param name="TimeSent" as="xs:anyAtomicType?"/>
<xsl:sequence select="xs:date(current-date()) + xs:dayTimeDuration('P1D') "/>
</xsl:function>
<xsl:template match="/">
<xsl:param name="TimeSent"/>
<soapenv:Envelope xmlns:olsa="http://www.skillsoft.com/services/olsa_v1_0/" xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/">
<soapenv:Header>
<wsse:Security soapenv:mustUnderstand="1" xmlns:wsse="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd">
<wsu:Timestamp wsu:Id="Timestamp-191900" xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd">
<wsu:Created>
<xsl:value-of select="$TimeSent"/>
</wsu:Created>
<wsu:Expires>
<xsl:value-of select="concat(substring(functx:next-day($TimeSent) ,1,10) ,'T', current-time())"/> </wsu:Expires>
</wsu:Timestamp>
<wsse:UsernameToken wsu:Id="UsernameToken-19030197" xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd">
<wsse:Username>ABC</wsse:Username>
<wsse:Password Type="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-username-token-profile-1.0#PasswordDigest">XYZ</wsse:Password>
<wsse:Nonce>erDTBNoUWv7GdHDaErrLwA==</wsse:Nonce>
<wsu:Created>2011-02-15T23:24:56.763Z</wsu:Created>
</wsse:UsernameToken>
</wsse:Security>
</soapenv:Header>
<soapenv:Body>
<olsa:GetMultiActionSignOnUrlRequest>
<olsa:customerId>ABC</olsa:customerId>
<olsa:userName>XYZ</olsa:userName>
<olsa:actionType>launch</olsa:actionType>
<olsa:assetId>222499_eng</olsa:assetId>
<olsa:groupCode>testgrp</olsa:groupCode>
</olsa:GetMultiActionSignOnUrlRequest>
</soapenv:Body>
</soapenv:Envelope>
</xsl:template>
</xsl:stylesheet>
Thanks
Shikha Jain
Edited by: Jain Shikha on Apr 2, 2011 9:51 PM -
How to add one new tab at item label in me21n
hi experts,
i am very new in badi .can any one please tell me how to add
one tab in me21n at item label. i already checked sample code for
badi me_gui_po_cust. i create one implementation and write same code.
this code is coming in debugging mode but cant see that tab while executing
me21n.
please help me out.
thanks in advance
manasiHi Manasi,
acording to me you are on the right path.Some help
1.ME_GUI_PO_CUST.
For Creating Customer own Screen - Purchase Order..
Details :
Go to the sample code of this BADI.
For this create a Function group with the screen that u want in PO.
In the First method u want to append the screen . There is one parameter im_element.
In this parameter u can mention that in which part u want the screen .Header/Item.
2. ME_PROCESS_PO_CUST
In this BADI u can Check the Complete PO at various Level.
ie Header Level ,Item Level, At the time of Save, Post .
Now Create a Include in your Function group and paste the below code.
DATA: call_subscreen TYPE sy-dynnr, "#EC NEEDED
call_prog TYPE sy-repid, "#EC NEEDED
call_view TYPE REF TO cl_screen_view_mm, "#EC NEEDED
call_view_stack TYPE REF TO cl_screen_view_mm OCCURS 0, "#EC NEEDED
global_framework TYPE REF TO cl_framework_mm, "#EC NEEDED
global_help_view TYPE REF TO cl_screen_view_mm, "#EC NEEDED
global_help_prog TYPE sy-repid. "#EC NEEDED
FORM SET_SUBSCREEN_AND_PROG *
--> DYNNR *
--> PROG *
--> VIEW *
--> TO *
--> CL_SCREEN_VIEW_MM *
FORM set_subscreen_and_prog USING dynnr TYPE sy-dynnr
prog TYPE sy-repid
view TYPE REF TO cl_screen_view_mm.
call_subscreen = dynnr.
call_prog = prog.
call_view = view.
ENDFORM. "set_subscreen_and_prog
Hope to solve ur probs.....
Regards
Renu -
How to add one more field to an exist internal table
hi abapers
i am a very new abap programmer and just started learning it.
i want to know How to add one more field to an exist internal table.
lemme me put my question in a very simple way.
i have a internal table having fields f1,f2,f3 and which also that internal also contains some data.
now i want to add two more fields (mm & nn) to that internal table now.
how can i do that.
and i wanna know the websites names where i can find some brain teasing questions in abap programming.
eagerly waiting for ur reply
regards,
Maqsood A KhanHi, MAQSOOD.
You can insert more fields in your internal table like this.
refer this code snippet.
DATA : BEGIN OF tbl_itab OCCURS 0.
INCLUDE STRUCTURE zsdtc009.
DATA : vkorg LIKE vbak-vkorg, "inserted one
vtweg LIKE vbak-vtweg, "inserted one
vkbur LIKE vbak-vkbur, "inserted one
vkgrp LIKE vbak-vkgrp, "inserted one
END OF tbl_itab.
you can also read the book "Teach yourself abap in 21 days"
at http://cma.zdnet.com/book/abap/
but that book is just about basic concept of abap and report program.
it doesn't give a lecture for on-line program.
you can get pdf version books(about abap, sap...things) from sap.
http://help.sap.com/printdocu/core/Print46c/en/Data/htm/english.htm
I wish I could help you.
Regards
Kyung Woo. -
How to add one or two photos without synchronise my 8240 photos on my ipad2
How to add one or two photos without synchronize my 8240 photos on my ipad2 or iPhon4 ?
Thank youJust add the photos to the folders/location that you last synced and sync them - as only the contents of the last photo sync remains on the iPad, you have to (re-)sync all the photos that you want on the iPad. In theory only the new photos will need processing by the sync process, so it shouldn't take a long time to sync (it hasn't for me when I've added a few to my 1500 photos in the past anyway). Not including photos in a sync is how you remove them from the iPad.
Your alternative is to email them to yourself and then save them from the email, but they will only go into the Saved Photos/Camera Roll album - come iOS 5 in the Autumn you should then be able to move photos between albums. -
How to add a sound on some slides?
How to add a sound on some slides? Not only one slide and not all the slideshow?
Is it possible? It must be!Keynote is not Powerpoint and vice versa. The way music is currently handled in Keynote has been explained. If you wish music to play across only a few contiguous slides, you make them a seperate file and hyperlink to them using an object for the hyperlink.
Once built, and properly used, the transition from one set of slides to the next set is smooth and the audience will not know (or care) if there is one, two or fifty hyperlinked files behind the curtain. What they see is the content, the message and the effective use of a visuals to backup your actual live presentation. The files you create are not the presentation, you and all you bring to the audience are the presentation. You are simply using a tool to assist youself to help your audience better understand your message.
Using Keynote is found by many presenters to be an easier application to use. If you find Powerpoint easier, by all means use it. Your message will be basically the same to your audience, if done properly.
Feedback is a good way to ask for changes but given the rate of change, learning those few simple workarounds and using them effectively will help you use Keynote (or Powerpoint - yes there are limitations there too) to easily put your point across. Your audience will sense your frustrations as a distraction so it is better to accept the few limitations and make your presentation shine in spite of them.
Good luck. -
Can anyone help with associate my new iPhone with iTunes? My other old devices are there, but I see only how to delete one, not how to add one. Thank you.
iTunes Match is a subscription system that allows you to upload your own music (e.g. coped from CDs) to the cloud so that it shows (in the cloud) on your devices and computers without having to sync/copy it.
Automatic downloads allows to, for example, buy an app on your computer's iTunes and have it automatically download on your phone without having to connect and sync it or go to the Purchased tab in the App Store app on your download and download it yourself - but doing that, going to the Purchased tab and redownloading an app, should get it associated.
But no, I'm not aware of any problems that not having it associated causes. -
How to add one more values in Search Criteria,
Hi All,
OAF page Search Criteria :
Search By "name"only Available already have in the search criteria .we are need to add Description in search criteria .How to add one more filed “Description” in Search Criteria,
Please Help Me
Thanks
Rajavel"Set the Search Allowed property to True for any LOV result items you want to present to the user as searchable values. These items are listed in the search poplist the user sees in the LOV window.
At a minimum you must set the Search Allowed property to True for the the result table item corresponding to the LOV field on the base page.
This is from the devguide, I suggest you read it once at least if you have started work on the framework.
Tapash -
How to add multiple table when creating add on using b1de
Hi all,
Plz help me
How to add multiple table when creating add on using b1de.
ThanksHi dns_sap,
Can you explain a little better what you are trying to accomplish? Is it to create UserTables and UserFields in the database, when the addon runs the first time?
If so, you can use the following code
Add User Table
Try
Dim lRetCode As Long
Dim oUDT As SAPbobsCOM.UserTablesMD = oCompany.GetBusinessObject(SAPbobsCOM.BoObjectTypes.oUserTables)
oUDT.TableName = TableName
oUDT.TableDescription = TableDescription
oUDT.TableType = TableType
lRetCode = oUDT.Add
'// Check for error when adding the Table: if lRetCode = 0 the table was created; if lRetCode = -2035 the table already exisits
If lRetCode <> 0 Then
oApplication.MessageBox("Error: " & lRetCode.ToString & ", " & oCompany.GetLastErrorDescription)
End If
Catch ex As Exception
oApplication.MessageBox(oCompany.GetLastErrorDescription)
Finally
System.Runtime.InteropServices.Marshal.ReleaseComObject(oUDT)
oUDT = Nothing
lRetCode = Nothing
GC.Collect()
End Try
Add User Field
Try
Dim lRetCode As Long
Dim oUDF As SAPbobsCOM.UserFieldsMD = oCompany.GetBusinessObject(SAPbobsCOM.BoObjectTypes.oUserFields)
oUDF.TableName = TableName
oUDF.Name = FieldName
oUDF.Description = FieldDescription
oUDF.Type = FieldType
lRetCode = oUDF.Add
'// Check for error when adding the field: if lRetCode = 0 the field was created; if lRetCode = -2035, the field already exists
If lRetCode <> 0 Then
oApplication.MessageBox("Error: " & oCompany.GetLastErrorCode & ", " & oCompany.GetLastErrorDescription)
End If
Catch ex As Exception
oApplication.MessageBox(oCompany.GetLastErrorDescription)
Finally
System.Runtime.InteropServices.Marshal.ReleaseComObject(oUDF)
oUDF = Nothing
lRetCode = Nothing
GC.Collect()
End Try
Regards,
Vítor Vieira -
How to add one form to specific responsibility
Hi ,
I need help from you guys regarding how to add one form to specific responsibility,having sysadmin responsibility i can able to view that form name but don't have idea how to include the form to that particular responsibility.
Much appreciated for your help
Thanks,
Babu1. Query the responsibility name (from Security > Responsibility > Define) and get the menu
2. Navigate to Application > Menu, and query the menu you got from the previous step
3. Add the form to the menu
Thanks,
Hussein -
How to add one tabstrip to standard transation
Hi Guy's,
Please help me how to add one tabstrip to standard tranasation it is urgent.
Thanks and Regards,
Sai.Hi,
Search any user exits or badi's for the standard one.
So that u can place ur tab strip there.
Regards,
Angi -
How to add one column in existing search help.
Hi Folks,
My quesion is
How to add one column in existing search help and also Now search help on that field is not an explicit search help. It should be implement using check table.
ShivamHi,
If you want to add a field in Elementary search help, get the search help name for the and go to change mode and add the field in it.
If you want to add a field in collective search help, go to included search helps tab and a new search help name and add the fields to it.
I think this should help you to certain extent.
Regards,
Kranthi
Edited by: Kranthi on Jan 14, 2010 11:15 AM -
How to add one column to the standard t.code : CAT2.
Hi,
How to add one column to the standard t.code : CAT2.
thanksHi Chinna
see the enhancements by using SMOD <b>CATS0007</b> , or <b>CATS0012</b> and create a project using CMOD and you can implement your requirement.
Hope This Info Helps YOU.
<i>Reward Points If It Helps YOU.</i>
Regards,
Raghav
Maybe you are looking for
-
I have started a new thread as I have not had much luck with the previous posts! I'm hoping that someone out there may be able to help me with this....... (Intel Mac Pro running 10.6.8) A brief summary of the situation: I have been having lots of pro
-
After reformatting my hard drive after a crash involving my hard drive's directory and migrating my backup data from my Time Machine drive in Lion 10.7.5, suddenly my Safari v. 5.1.7 won't open and crashes repeatedly. . The long crash report [below,
-
Error when using weblogic portal 10.3.5
Hi, everyone. - I'm using weblogic portal 10.3.2 to develop a portal. Now, i deploy my project for customer but they want to deploy it in Centos OS. - I down load weblogic portal form oracle site but it don't have 10.3.2 version. I use the latest ver
-
Is Observable thread safe?
hello im trying to write a programme that uses observer observable. I have an observing class that may be observing 3 or 4 instances of an observable class. each of these observable classes runs a separate thread. Am i right to think that when an obs
-
Appleworks Crashes When I Try To Save Document
My Appleworks crashes immediately after I click "Save" or "Save As", losing the document. I tried deleting all the Applework preferences which did not work. I also tried running the Disk Utility on my entire Hard Drive which did not do anything eithe