How to get data from textfield from an other class
Hello everyone,
I have a problem with an application I am writing for school. I want to get the data from a textfield into an other class.
I have two classes: KlantGui and KlantMenuGui
Some Codes from KlantGui:
public String klantNummer;
//knr
knr = new JTextField(10);
p2.add(knr);
//getValue
public String getValue() {
return knr.getText();
//getKlantNummer
public String getKlantNummer(){
klantNummer = getValue();
return klantNummer;
}And this one is from KlantMenuGui:
private KlantGui kg = new KlantGui();
//This is where I want the data to display
String klantnr = kg.getKlantNummer();
p2.add(new JLabel (" Klantnr: "));
tf4 = new JTextField (10);
p2.add(tf4);
tf4.setEditable(false);
tf4.setText(klantnr);I don't know why but it seems like the getValue() doesn't sends the data. For example if I write klantNummer = "2" instead of klantNummer = getValue(); it does work and I see 2 in the other class.
Thanks!
Does knr ever get populated?
From the code below, you create an instance of a KlantGui, but this will have no values set, then straight away call getValue, which returns "", which is correct since the textfield for the instance of KlantGui just created would be empty?
Similar Messages
-
How to get data in jtable from database
i m working on core java application i want to use jtable to show records to user. jtable will get records from mssql database. how to do this.. i m new so plz tell me briefly..with coding...
thanksi have use this link:
import java.sql.*;
import javax.swing.table.*;
import javax.swing.event.*;
* This class takes a JDBC ResultSet object and implements the TableModel
* interface in terms of it so that a Swing JTable component can display the
* contents of the ResultSet. Note that it requires a scrollable JDBC 2.0
* ResultSet. Also note that it provides read-only access to the results
public class ResultSetTableModel implements TableModel {
ResultSet results; // The ResultSet to interpret
ResultSetMetaData metadata; // Additional information about the results
int numcols, numrows; // How many rows and columns in the table
* This constructor creates a TableModel from a ResultSet. It is package
* private because it is only intended to be used by
* ResultSetTableModelFactory, which is what you should use to obtain a
* ResultSetTableModel
ResultSetTableModel(ResultSet results) throws SQLException {
this.results = results; // Save the results
metadata = results.getMetaData(); // Get metadata on them
numcols = metadata.getColumnCount(); // How many columns?
results.last(); // Move to last row
numrows = results.getRow(); // How many rows?
* Call this when done with the table model. It closes the ResultSet and
* the Statement object used to create it.
public void close() {
try { results.getStatement().close(); }
catch(SQLException e) {};
/** Automatically close when we're garbage collected */
protected void finalize() { close(); }
// These two TableModel methods return the size of the table
public int getColumnCount() { return numcols; }
public int getRowCount() { return numrows; }
// This TableModel method returns columns names from the ResultSetMetaData
public String getColumnName(int column) {
try {
return metadata.getColumnLabel(column+1);
} catch (SQLException e) { return e.toString(); }
// This TableModel method specifies the data type for each column.
// We could map SQL types to Java types, but for this example, we'll just
// convert all the returned data to strings.
public Class getColumnClass(int column) { return String.class; }
* This is the key method of TableModel: it returns the value at each cell
* of the table. We use strings in this case. If anything goes wrong, we
* return the exception as a string, so it will be displayed in the table.
* Note that SQL row and column numbers start at 1, but TableModel column
* numbers start at 0.
public Object getValueAt(int row, int column) {
try {
results.absolute(row+1); // Go to the specified row
Object o = results.getObject(column+1); // Get value of the column
if (o == null) return null;
else return o.toString(); // Convert it to a string
} catch (SQLException e) { return e.toString(); }
// Our table isn't editable
public boolean isCellEditable(int row, int column) { return false; }
// Since its not editable, we don't need to implement these methods
public void setValueAt(Object value, int row, int column) {}
public void addTableModelListener(TableModelListener l) {}
public void removeTableModelListener(TableModelListener l) {}
the table is showing column name from database but not showing the data in row now what to do -
How to get Date Format from Local Object.
Hi All,
I am new to Web Channel.
I need to know Date format From date of locale.
suppose there is a date "01/25/2010" date in date field I want to get string "mm/dd/yyyy". Actually I have to pass date format to backend when I call RFC.
Is there any way to get Date format from "Locale" object. I should get date format for local object
I get local object from "UserSessionData" object but how to get Date format from it.
I am not looking for Date value. I am looking for current local date format ("mm/dd/yyyy or dd/mm/yyyy or mon/dd/yyyy) whatever local date format. I could not find example which show how to get date format from "Locale" object.
Any help will be appreciated with rewards.
Regards.
Web ChannelHi,
You can get it from "User" or "Shop" business object.
Try to get User or Shop Business Object as shown below.
BusinessObjectManager bom = (BusinessObjectManager) userSessionData.getBOM(BusinessObjectManager.ISACORE_BOM);
User user = bom.getUser();
char decimalNotation = user.getDecimalPointFormat().getGroupingSeparator();
If you are seeing "1,234.00" then above code will return "."
I hope this information help you to resolve your issue.
eCommerce Developer. -
For some reason the system is telling me my birth date is wrong when it's not and it won't let me proceed to reset my password. Can someone tell me how to get a "real" person from tech on line?
contact itunes support
-
How to get data from a USB-UIRT device using Labview?
How to get data from a USB-UIRT device using Labview?
I'm trying to get data from a USB-UIRT device, is it posible with Labview?
I really appreciate your help,
thanksYou may want to contact the developer of the device for the API and DLL.
http://65.36.202.170/phpBB2/viewforum.php?f=3 -
How to get data from BW Cube to Another File system?
Hi,
I have a requirement to get the sales data from BW system(infoCube) to another file system as XML file using XI as a middleware. Can anybody give the suggestions on this please?
Thanks & Regards,
SatishTake a look at the following document. You will get a fair idea how to integrate BW and XI.
BW > XI
https://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/com.sap.km.cm.docs/library/biw/g-i/integrate bw via xi.pdf
XI> BW
https://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/com.sap.km.cm.docs/library/biw/g-i/how to push data into bw from xi.pdf
regards
SKM -
i have three tables A,B,C. there is one to many relation between A and B. and one to many relation existed between table b and c . how will get data from these three tables
check if this helps:
select * --you can always frame your column set
from tableA a
left join tableB b on a.aid=b.aid
left join tableC c on c.bid=b.bid
This is just a general query. However, we can help you a lot more, if you can post the DDL + sample data and required output.
Thanks,
Jay
<If the post was helpful mark as 'Helpful' and if the post answered your query, mark as 'Answered'> -
How i get data in matrix grid from A/P Invoice
How i get data in matrix grid from A/P Invoice before click add button
Hi,
Are you trying to read the data in the matrix of a system form? Then you only have to look for the matrix with the ID you can see by visualising the System Information in B1 and then directly read from the matrix cells (using columns element in matrix), the DBDataSources are not filled in until the document has been added to the database.
There are many messages in this forum talking about how to read information in matrix item, just make a search for it.
Hope it helps
Trinidad. -
How to get data with the raw pattern from resultset ?
would you tell me how to get data with the raw pattern from resultset ?
thank you in advance!
longgger2000I tried getBytes() and getObject()
, but I can not get the right result , for example the
data in oracle database is 01000000DFFF, when In used
the method of getBytes() and getObject(), I get the
result of [B@1c2e8a4, very different , please tell me
why !
thank you
longgger2000
[B is byte arrayseem that it return an bytes array for you. -
How to get data to internal table from function module tr_inspect_objects
How to get data from funtion module to an internal table .
function module name is tr_inspect_objects(code inspectore se10)
how top collect all task request data into one internal table using this fm or we have to create another fm .
If you have already made FM please give us the code .Hi,
You can use tables E070 or E071 to get data into your internal tables instead of a function module.
Hope this helps.
BR
Dep -
How to get data from MS CRM into Crystal Reports
Hello All,
Can anybody tell me how to get data into crystal XI reports with MS CRM.
Thanks in Advance
RameshFirst you should refer to the Rules of Engagement and then add more info.
Start off by telling us what version of CR are you using and what is MS CRM?
Thank you
Don -
How to get the extension Info from firefox? Do we have any firefox API to communicate with the browser? I couldnt see the HTML of the widget displayed in the toolbar how to access the widget using JS or any way
Hi,
Thanks for the suggestion. I've been playing around with some of the classes of the java.net package and java.io
Using the URL class i can get the content of the data from a STATIC page and output that response to file so that is does not display to the client broswer.
But this only works if the URL i give points to a static html page.
So the problem i'm getting is if i'm righting in arguments in the URL, this means that server needs to process the arguments i give and its sends back a dynamic result. Because its dynamic the URL class can not handle this and throws me an exception everytime :(
Have u ever tried to do some things like this?
Rahul -
How to get the Database type from weblogic Db connection
I want to use database version control in my application . that means different database type use different Sql Statement. Such as in weblogic7.0 if I create SqlServer JDBC pool then I will use some special Sqlserver sql Statement . such as some join statement. If I create Oralce JDBC pool then I have to use different Sql statement . because these two database support different Sql statement.
What my question is how to get the database type from the connection.For a normal jdbc driver you can use
Connection.getMetaData()
To get the meta data, in particular the getDatabase...() methods.
That might or might not work.
However, at the very least in the server you have access to the weblogic properties so you can parse the pool property to figure it out. -
How-to extract data in chunks from one R3 to another R3 system
Does anybody know how to extract data in chunks from one system to another? Imagine you would like to extract 1M records in chunks of 10K records, how would you do it between 2 different R3 systems? A cursor (even with hold) doesn't work
Any suggestion appreciated
Thanks
IoanHi Ioan,
I'd do it with fm : TABLE_ENTRIES_GET_VIA_RFC (with where clause-tab)
or fm GET_TABLE_RFC (get all items)
regards Andreas -
How to get day of week from NSDate?
How to get day of week from NSDate?
Here's a way to get the name of the weekday as an NSString if you've already got an NSDate...
NSDate * testDate = [NSDate date];
NSString * weekdayString = [testDate descriptionWithCalendarFormat:@"%A" timeZone:nil
locale:[[NSUserDefaults standardUserDefaults] dictionaryRepresentation]];
NSLog(@"Day of the week: %@", weekdayString);
The output is something like:
Day of the week: Monday
You can use a lower-case "%a" as the descriptionWithCalendarFormat if you just want the three character weekday abbreviation ("Mon", "Tue", "Wed", etc).
Steve
Maybe you are looking for
-
Error: Automation Error while creating a new app
Hello Experts, Have installed FDM on one of our servers and trying to create a new application. Getting the following Error: Error: Automation Error. The System cannot find the file specified. We are using Oracle OLE DB Provider. Kindly Advise. Edite
-
i have a iphn 3gs running on ios 6.1.3 i buy it frm my frnd ..........n it has one prblm that safari mail n maps does't wrk it crashes all time when i try to run these ......plzzz help me what shoud i do ......i have tried reset many times bt it do
-
hi all, We have Oracle 10g RAC on IBM AIX Today i will be uploading data in a table through sql loader. I want that at the time of insertion only data which i am inserting goes into the table,As i am using sequence on particular column A. Problem is
-
Why is ByteBuffer crashing?
hi, i have a program where i want to write to a bunch of bytes, in small groups, to a ByteBuffer of a specific size. Once that ByteBuffer reaches 50K bytes I want to write that whole thing to a file as a ZipEntry. I have allocated the ByteBuffer and
-
Buenos dias, estoy usando la CS6 y abro photoshop y otros programas sin ningún problema pero cuando abro after effects me dice que no se puede utilizar en la OS X porque lel AE es una versión 11.0,que debo hacer, mi mac esta actualizada