Another last problem, thanks

hi,
I have another question,
here's goes,
I will need to make a frame that inside there will be text field, one button, and label and when
you click on the button what is written inside the textfield will go to the label.
something like this:
textfield: button:
Label
thanks, Einat

Next time try it yourself and then give us your code and ask specific questions, ask us to do this for you and you will get flamed.
The below program needs to be improved layout wise and in other ways (just in case this is your homework you will still have work to do) but it will get you started.
import javax.swing.*;
import java.awt.*;
import java.awt.event.*;
public class TestFrame extends JFrame implements ActionListener{
public JTextField textField;
public JButton button;
public JLabel label;
public TestFrame( String title ) {
super( title );
this.setSize( 300,300 );
this.getContentPane().setLayout( new FlowLayout( FlowLayout.LEFT ) );
textField = new JTextField( "Value" );
button = new JButton( "Put Text" );
label = new JLabel();
button.addActionListener( this );
this.getContentPane().add( textField );
this.getContentPane().add( button );
this.getContentPane().add( label );
this.show();
public void actionPerformed( ActionEvent ae ) {
Object source = ae.getSource();
if ( source == button ) {
label.setText( textField.getText() );;
this.validate();
this.repaint();
public static void main( String args[] ) {
new TestFrame( "Testing" );

Similar Messages

  • Another connection problem (with a lot of solution advices tried o

    hi everybody,
    since yesterday i'm a proud owner (more or less) of a zen x-fi. the only thing that dri'ves me crazy is that i can't get it working with windows.
    first of all the system config:
    Desktop PC (P4 on 95P Express chipset)
    Windows XP Pro SP3
    Media Player
    i searched the web and am trying to solve this problem: "there was a problem installing ..." for quite a long time now.
    here's what i did up until now:
    - deinstalling Media Player and installing v0 - couldn't deinstall v
    - installing newest version of the WMP (v - 5th Oct. 2008) from Microsoft to get the newest MTP support
    - deinstalling the "Creative Centrale" and reinstalling it (at the moments it's uninstalled)
    - installing Microsoft User Driver Framework v.0 (wouldn't allow me - of course, because it's implemented with WMP or rather it's drivers are older)
    - setting USB ENUM to "read" and "full control"
    - deinstalling and reinstalling the USB drivers (motherboard support as well as chipset vendor newest drivers)
    - checking every single USB port (front and back)
    - settings for USB HUBs to "full power supply" (no Power Management)
    - reinstalled SP3
    - got all new Updates from Windows (critical updates) including all up to date .Net Framework versions
    - tried the Media Transfer Protocol Porting Kit (quite sure that this doesn't do anything since it seems to be the sdk version and i know to little of programming to try something out)?
    - downloaded the fixup (found it in different posts to have been a workaround) and there was a little success: i got a working driver (no "there was a problem installing ...") until i realized that it doesn't show anything inside the folder (mtp/portable device) neither does it say "zen x-fi" in the device manager (it's only called "mtp device"). checked the .inf in the fixup package and realized that it couldn't work as long as i don't know the x-fi's Product ID, which i searched for on the internet (linux forums etc.) but the x-fi seems to be too new
    now: i of course tried it on another PC to be sure (Laptop with Windows XP Pro SP3 and WMP 0!) - and it works ...
    downside is: my library is fairly big and would fit on the Laptop's harddri've. i found a little workaround and imported the folder into the laptop's winamp library (via Network) and got some songs onto the Zen but it takes a lot of time getting them through the network connection (WLAN).
    as i see it there's only two chances: either the USB is not suitable (which i can't believe, since everything else that i attach is working fine and without any issues) or the problem has something to do with the Media Player's MTP.
    so does anyone have another idea or would i have to wait for either Windows or Creative to come up with a solution(maybe another hotfix)?
    thanks in advance
    regards
    al

    Ive been having hell with this aswell, although i think my computer is to blame. It "should" work if i could install wmp, but i cannot because my computer needs me to install some update rollup 2 which doesnt install and i cant install sp3 either... i've been contacting microsoft but they cant sort it.. maybe my pc is just reaching its old age and cannot cope with so many new things going on.
    but from what you have said i cant see why it shouldnt work with your current system.

  • YAPP (Yet Another Printing Problem)

    I've found another printing problem - this time with colour printing.
    To my
    surprise, Forte (3.0.E.0) can print in colour (at least on a HP 690C,
    using
    NT drivers for the 660C, the printer being connected to a Win95
    machine).
    I can print OK with from my NT develpoment machine in colour, but when
    running
    the same app from the Win95 client with the printer attached locally the
    coloured text disappears. Has anyone else come across this problem?
    Is this another of the 'Printing works fine as long as it happens
    non-locally?'
    features?
    Thanks
    Jamie Anstice
    Programmer/Analyst, University of Canterbury
    New Zealand

    I can print OK with from my NT develpoment machine in colour, but when
    running
    the same app from the Win95 client with the printer attached locally the
    coloured text disappears. Has anyone else come across this problem?Hi Jamie,
    I wonder if this is related to the printing feature I discovered
    where things I print from Forte have a strong tendency to come out in
    the same colours as my windows desktop, which is
    typically yellow-on-black.
    - Ed
    ================================================================================
    Eduard E Havelaar, Information Services Section, University of Canterbury
    email: [email protected]
    phone: +64-3-366 7001 extn 8910
    fax: +64-3-364 2999
    snailmail: Private Bag 4800, Christchurch, New Zealand

  • Hi I have a MacBook Pro 2011 i7 and it stays on for about 4 hours then the screen go's fuzzy and I have to turn it off by the power button has anyone had this problem thanks mike

    I Have a MacBook Pro i7 2011 it stays on for about 4 hours then the screen go's all fuzzy and I have to turn it off by the power button has any body else had this problem thanks mike

    My guess would also be a failling connection between your logicboard and your GPU. See 2011 MacBook Pro and Discrete Graphics Card
    For most users it starts with some random crashes and freezes like you describe it. And then it just gets worse and worse. There are still no "good" solutions, sadly. This is a hardware problem from the production.

  • Please can someone tell me how to access my iTunes library on a pc I no longer have and transfer it to another laptop?  Thank you

    Hello Please can anyone tell me how to access and transfer my iTunes library from a pc I no longer have to another laptop?  Thank you

    You cannot.  Your library is on that computer.  If you do not have that computer, then you do not have the library.
    Have you failed to maintain a backup copy?
    If so, not good, you can redownload some iTunes purchases in some countries.  Click Purchases under Quick Links in the iTunes store.

  • Hi! How can I change the shipping address for the program of replacement of the 1 generation ipod nano? I've already received the empty box and now I should send back the old ipod but I'd like to receive the new one to another address. Thank you.

    Hi! How can I change the shipping address for the program of replacement of the 1 generation ipod nano? I've already received the empty box and now I should send back the old ipod but I'd like to receive the new one to another address. Thank you.

    I would contact Apple directly and have them work with to get the iPod shipped to a new/different address.
    http://www.apple.com/contact/
    B-rock

  • I can't click below the toolbar .half inch to 3inch from right to left. all words or letters are not working. please help to resolve this problem. thanks!

    Everytime I open firefox, all words or letters below the toolbar half inch to 3 inch from right to left are not clickable(not working). but they are working or clickable on google crhome or internet explorer. please help to resolve this problem. thanks!

    The '''''Yahoo! Toolbar''''' and the '''''Babylon''''' extension have been reported to cause that problem. They seem to invisibly extend downward over the top of the web page display area. Disable or uninstall those add-ons.
    *See --> http://support.mozilla.com/en-US/kb/Uninstalling+add-ons
    *See --> http://support.mozilla.com/en-US/kb/Cannot%20uninstall%20an%20add-on
    *See --> http://kb.mozillazine.org/Uninstalling_toolbars
    *See --> https://support.mozilla.com/kb/Troubleshooting+extensions+and+themes
    '''If this reply solves your problem, please click "Solved It" next to this reply when <u>signed-in</u> to the forum.'''
    Not related to your question, but...
    You may need to update some plug-ins. Check your plug-ins and update as necessary:
    *Plug-in check --> http://www.mozilla.org/en-US/plugincheck/
    *Adobe Shockwave for Director Netscape plug-in: [https://support.mozilla.com/en-US/kb/Using%20the%20Shockwave%20plugin%20with%20Firefox#w_installing-shockwave Installing ('''''or Updating''''') the Shockwave plugin with Firefox]
    *Adobe PDF Plug-In For Firefox and Netscape: [https://support.mozilla.com/en-US/kb/Using%20the%20Adobe%20Reader%20plugin%20with%20Firefox#w_installing-and-updating-adobe-reader Installing/Updating Adobe Reader in Firefox]
    *Shockwave Flash (Adobe Flash or Flash): [https://support.mozilla.com/en-US/kb/Managing%20the%20Flash%20plugin#w_updating-flash Updating Flash in Firefox]
    *Next Generation Java Plug-in for Mozilla browsers: [https://support.mozilla.com/en-US/kb/Using%20the%20Java%20plugin%20with%20Firefox#w_installing-or-updating-java Installing or Updating Java in Firefox]

  • I'm the proud owner of 1200 Classical CDs which I ripped and loaded in my iTunes library. How can I copy it to another Mac? Thanks for your help.

    I'm the proud owner of 1200 Classical CDs which I ripped and loaded in my iTunes library, together with a couple dozen videos downloaded fro youtube. These are not (with a few exceptions, maybe 20 records) items purchased  in the iTunes store. How can I copy this library to another Mac? Thanks for your help.

    How to Move Your Music to a New Computer.

  • Last problem in my project!!

    i've intend to open this 'Receipt.class' by clicking button from other class file called 'Main.class'
    Normally we used this statement "Receipt open = new Receipt();" to open,
    but what if the class file is like that??
    Please help me even giving me the clues!! please.. this is my last problem in my project!!!
    import java.awt.geom.*;
    import java.awt.event.ActionListener;
    import java.awt.event.ActionEvent;
    import java.awt.print.PrinterJob;
    import java.awt.event.*;
    import java.awt.*;
    import javax.swing.*;
    import java.awt.print.*;
    public class Receipt extends JPanel implements Printable, ActionListener {
    final static JButton button = new JButton("Print");
    public Receipt() {
         setBackground(Color.white);
    button.addActionListener(this);
    init();
    public void actionPerformed(ActionEvent e) {
    if (e.getSource() instanceof JButton) {  
    PrinterJob printJob = PrinterJob.getPrinterJob();
    printJob.setPrintable(this);
    if (printJob.printDialog()) {
    try {
    printJob.print();
    catch (Exception ex) {
    ex.printStackTrace();
    public void paintComponent(Graphics g) {
         super.paintComponent(g);
         Graphics2D g2 = (Graphics2D) g;
         drawShapes(g2);
    public void drawShapes(Graphics2D g2){
    g2.drawString("Hello world",50,50);
    public int print(Graphics g, PageFormat pf, int pi) throws PrinterException {
    if (pi >= 1) {
    return Printable.NO_SUCH_PAGE;
         drawShapes((Graphics2D) g);
    return Printable.PAGE_EXISTS;
    public void init{
         JFrame f = new JFrame();
         JPanel panel = new JPanel();
         panel.add(button);
         f.getContentPane().add(BorderLayout.SOUTH, panel);
         f.getContentPane().add(BorderLayout.CENTER, new Receipt());
         f.setSize(580, 500);
         f.show();

    I don't quite get your question. What did you mean by open? Did you mean to display it. Receipt is a JPanel, to show it you need to have it inside a Frame or an Applet or some sort of container.
    try this
    import javax.swing.*;
    Receipt receipt = new Receipt();
    JFrame aFrame = new JFrame("Display Receipt Panel"); //create a JFrame
    aFrame.getContentPane().setLayout(new BorderLayout()); //set Layout Manager for the frame
    aFrame.getContentPane().add(receipt, BorderLayout.CENTER); //add panel to the frame
    aFrame.show(); //show the frameThe above block of codes create a JFrame and add the Receipt panel to the Frame. Then call the Frame to show. You can put this code in a method, if you need to use this Frame and panel again, make them instance variables rather than local variables.

  • The safety site never tick auto fix ID andPasswords, why my security trading ac. still can auto fix my user ID.how to clear it, please teaching me to fix this problem.THANK YOU.

    M y firefox 10.0.2The safety site never tick auto fix ID andPasswords, why my security trading ac. still can auto fix my user ID.how to clear it, please teaching me to fix this problem.THANK YOU.

    http://www.omahapokernews.org
    http://www.holdempokernews.org
    http://www.7cardstudplay.net
    http://www.5cardstudplay.net
    http://www.holdemspot.org
    http://www.texasholdemstate.net
    http://www.texasholdemstate.com
    http://www.pokerbonuslist.net
    http://www.pokerdownloadz.org
    http://www.signuppoker.net
    http://www.tournamentpokerz.com
    http://www.pokercalculatorz.com
    http://www.omahaodds.org
    http://www.omahaouts.org
    http://www.texasholdemrulesonline.net
    http://www.onlineholdemtips.com
    http://www.pokerhilo.net
    http://www.poker-hilo.com
    http://www.hilopokers.com
    http://www.nolimit-holdempoker.net
    http://www.texasholdemlimits.org
    http://www.texasholdemlimits.net
    http://www.onlinepokerlimits.org
    http://www.onlinepokerlimits.net
    http://www.onlinepokerlimits.com
    http://www.texasholdemlimits.com
    http://www.7cardplayer.net
    http://www.5cardplayer.net
    http://www.omahaacademy.org
    http://www.omahapokerrooms.net
    http://www.onlinepokerroomstop.net
    http://www.playpoker-toppokerrooms.com
    http://www.texasholdemz.com
    http://www.playpokeronline-casinos.com
    http://www.texasholdem-vip.com
    http://www.gamble-poker-holdem.com
    http://www.playpoker-holdem.com
    http://www.onlinetexasholdem-poker.com
    http://www.texasholdempokeracademy.com
    http://www.vip-texasholdem.com
    http://www.playfree-poker-online.com
    http://www.texasholdem-pokerrooms.org
    http://www.toppokerrooms.ws
    http://www.toppokercasino.ws
    http://www.onlinepokercasino.ws
    http://www.playpoker-online.ws
    http://www.online-texasholdem.ws
    http://www.play-texas-holdem.ws
    http://www.internet-texas-holdem-poker.ws
    http://www.poker-player.ws
    http://www.luckyschool.com

  • I opened a Sync account before, and without saving the code I uninstalled it. But now using installed it again but do not have my Sync code to add the device. Is there anyway I can retrieve the code, without creating another account? Thanks!

    I created a Sync account before but uninstalled it without saving the code. But now installed it again and having trouble finding my account code to setup my Sync. Is there a way to retrieve my Sync code without creating another account?
    Thanks!

    Contact iTunes:
    Apple - Support - iTunes - Contact Us

  • Hello, i need help i'm doing experiment on ilab i have managed to put my experiment on the platform but when i try to launch it fails with an error 404 that the page not found. any one with idea of what i should do to solve this problem. thank you

    hello, i need help i'm doing experiment on ilab i have managed to put my experiment on the platform but when i try to launch it fails with an error 404 that the page not found. any one with idea of what i should do to solve this problem. thank you

    hey Sally,
    Can you elaborate on the ilab and what you are trying to do? I have found this page to explain error 404, but I am not sure if it directly applies to  you
    http://digital.ni.com/public.nsf/allkb/D0998D3734926FA08625782300016E40?OpenDocument
    Regards,
    A. Zaatari
    National Instruments
    Applications Engineer

  • My ipod touch 4G got problem after update to iOS 6, it can not access the Apps store ,can not access safari,map, weather and so on, could someone help me to solve the problem, thanks in advance~~~

    My ipod touch 4G got problem after update to iOS 6, it can not access the Apps store ,can not access safari,map, weather and so on, could someone help me to solve the problem, thanks in advance~~~

    Force close the App Store app and reset the iPad. No data will be lost when you reset the device.
    In order to close apps, you have to drag the app up from the multitasking display. Double tap the home button and you will see apps lined up going left to right across the screen. Swipe to get to the app that you want to close and then swipe "up" on the app preview thumbnail to close it.
    Next, reset the iPad by holding down on the sleep and home buttons at the same time for about 10-15 seconds until the Apple Logo appears - ignore the red slider if it appears on the screen - let go of the buttons. Let the iPad start up.

  • Hello please hepl me in my problem in apple id, i cannot connect to my ipad mini in itune store and app store because they find me a credit card but i dont have credit card. what can i do now? i need an answer for this problem. thank you

    hello please help me in my problem in apple id, i cannot connect to my ipad mini in itune store and app store because they find me a credit card but i dont have credit card. what can i do now? i need an answer for this problem. thank you

    I would suggest that you buy a visa or mastercard gift card and put a few dollars on it and use it to access the store.  Just add money to it before you want to buy something from the store and it will act like a normal credit card for you.

  • HT2292 when i press the download iTunes option, besides downloading the iTunes, it directs to another page saying thank you for installing and it dosent download the itunes...what should i do

    when i press the download iTunes option, besides downloading the iTunes, it directs to another page saying thank you for installing and it dosent download the itunes...what should i do

    See the further information area of Troubleshooting issues with iTunes for Windows updates.
    tt2

Maybe you are looking for

  • Which Apple app's will no longer work in Mavericks?

    I am using OS 10.8.5 on my MacbookAir.  I was contacted by Apple to download a free update to Mavericks, OS 10.9. I am very suspicious after having been many times forced to buy new apps working under newer Apple operating systems, because some previ

  • Can you take a look pls.....urgent

    i'm writing a tax calculator applet i've no compilation errors but my applet doesn't seems to run. can u guys pls help.... import java.applet.*; import java.awt.*; import java.awt.event.*; public class TaxCal extends Applet implements ActionListener

  • IPhoto 11 lag when in full screen mood?

    When I open my iPhoto 11 in full screen size, and start scrolling down the event it lag. However, when I scroll down the event when not in full screen, there is no lag. Is it normal or are there bugs? Help me please Thanks.

  • Videos in iphoto played before but now won't play

    I tried to create a slideshow and fooled around with some videos in it. Now they won't play. Help!

  • Map Viewer spatial data

    Hi , How can we  integrate MapViewer in OBIEE for a country that is not included in Oracle Spatial Data ? Thx