HELP!!! Begginer working with a Swing Applet. DON'T KNOW HOW TO DRAW LINE

Hi! I've been trying to draw a line in an applet and I can't. The thing is I'm using the tutorial to create the applet, so it comes with the standart methos and the standalone. I'm not sure if the problem is becausse I need to include in it a paint method or something.
What I'm trying to do is to connect the to blocks (they really are jButtons), with an arrow. Thanks!!!!!!!!!
Here's my code so far...// Copyright (c) 2000
package package14;
import javax.swing.*;
import java.awt.*;
import java.awt.event.*;
import oracle.jdeveloper.layout.*;
* Applet
* <P>
* @author Ana M Yanes Benatuil
public class Appletboxes extends JApplet {
boolean isStandalone = false;
XYLayout xYLayout1 = new XYLayout();
JButton jButton1 = new JButton();
JButton jButton2 = new JButton();
* Constructs a new instance.
* getParameter
* @param key
* @param def
* @return java.lang.String
public String getParameter(String key, String def) {
if (isStandalone) {
return System.getProperty(key, def);
if (getParameter(key) != null) {
return getParameter(key);
return def;
public Appletboxes() {
* Initializes the state of this instance.
* init
public void init() {
try {
jbInit();
catch (Exception e) {
e.printStackTrace();
private void jbInit() throws Exception {
this.getContentPane().setLayout(xYLayout1);
this.setSize(new Dimension(836, 545));
jButton1.setText("jButton1");
jButton2.setText("jButton2");
jButton2.addMouseMotionListener(new java.awt.event.MouseMotionAdapter() {
public void mouseDragged(MouseEvent e) {
jButton2_mouseDragged(e);
jButton1.addMouseMotionListener(new java.awt.event.MouseMotionAdapter() {
public void mouseDragged(MouseEvent e) {
jButton1_mouseDragged(e);
this.getContentPane().add(jButton1, new XYConstraints(137, 120, 96, 45));
this.getContentPane().add(jButton2, new XYConstraints(452, 118, 96, 49));
* start
public void start() {
* stop
public void stop() {
* destroy
public void destroy() {
* getAppletInfo
* @return java.lang.String
public String getAppletInfo() {
return "Applet Information";
* getParameterInfo
* @return java.lang.String[][]
public String[][] getParameterInfo() {
return null;
* main
* @param args
public static void main(String[] args) {
Appletboxes applet = new Appletboxes();
applet.isStandalone = true;
JFrame frame = new JFrame();
frame.setTitle("Applet Frame");
frame.getContentPane().add(applet, BorderLayout.CENTER);
applet.init();
applet.start();
frame.setSize(400, 420);
Dimension d = Toolkit.getDefaultToolkit().getScreenSize();
frame.setLocation((d.width - frame.getSize().width) / 2, (d.height - frame.getSize().height) / 2);
frame.setVisible(true);
frame.addWindowListener(new WindowAdapter() { public void windowClosing(WindowEvent e) { System.exit(0); } });
static {
try {
UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
catch(Exception e) {
e.printStackTrace();
void jButton1_mouseDragged(MouseEvent e) {
jButton1.setLocation(e.getX() + jButton1.getX() , e.getY() + jButton1.getY());
void jButton2_mouseDragged(MouseEvent e) {
jButton2.setLocation(e.getX() + jButton2.getX() , e.getY() + jButton2.getY());

The other thing is that the boxes can be dragged and dropped, so the lines would have to be moved too (if they're related to the moved blocks)

Similar Messages

  • SVM with QFS and a don´t know how growing a File Systems

    Hello Experts
    Please, Could some help me. I have a SVM with QFS and a don´t know how growing a File Systems in this configuration.
    can someone help me or share me a doc that would help me to do it?
    Thanks a Lot
    Joao Paulo ( email address removed by moderator so that you don't get spammed for all Eternity )

    I'm guessing that you mean a QFS file system built using SVM volumes? You want to grow a filesystem on these volumes?
    - How to grow the volumes depends on how they're built; this would require seeing either the command that built them or metastat -c for them. You have to expand each column of the volume equally if it is a striped volume type.
    - To extend the file system, you need to stop using it, edit the MCF properly to add the next extents, and then extend the file system. See the samgrowfs man page for details.
    I realize this isn't a definitive answer, but it's not possible to give you one without seeing the metastat output and the QFS MCF file.

  • My iPad 2 with iOS6 has a non-working iTunes and AppStore I don't know how to fix it

    Does anybody know how to fix this?

    Saw this on another post.
    Applecare Senior Advisor Txx Bxxx (I have his contact info in an email he just sent) just confirmed with me that the problem people are having with the App Store not loading is an apple issue with there servers, ITS NOT YOUR IPAD so don't go restoring it!   It's not happening to everyone however but they are looking into it, its really hit or miss.
    In the meantime ...........
    The Complete Guide to Using the iTunes Store
    http://www.ilounge.com/index.php/articles/comments/the-complete-guide-to-using-t he-itunes-store/
    Can't connect to the iTunes Store
    http://support.apple.com/kb/TS1368
    iTunes: Advanced iTunes Store troubleshooting
    http://support.apple.com/kb/TS3297
    Best Fixes for ‘Cannot Connect to iTunes Store’ Errors
    http://ipadinsight.com/ipad-tips-tricks/best-fixes-for-cannot-connect-to-itunes- store-errors/
    Try this first - 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 - let go of the buttons.
    This works for some users. Not sure why.
    Go to Settings>General>Date and Time> Set Automatically>Off. Set the date ahead by about a year.Then see if you can connect to the store.
     Cheers, Tom

  • In working with my calendar, i don't know what i might have done, but all entries on Fridays, starting from Friday, March 14, simply disappeared. my time machine was not functioning and am wondering if this info is hiding somewhere in the cloud?

    In working with icalendar, i inadvertantly lost all Friday entries after March 14th.  My time machine was not hooked up.  Hoped that the cloud might have this information.

    You can check to see if they are still in iCloud by looking at your calendar on icloud.com.  If they are, go to System Preferences>iCloud on your Mac, uncheck Calendars, choose Delete from Mac (they will still be in iCloud), restart your Mac, then go back and sign back in.  If they aren't on icloud.com you might just give it some time to see if they reappear due to a server glitch.

  • TS3274 I only have a 16gig ipad. I have bought some music that I want to get rid of so that I can sync with my laptop but don't know how to delete stuff from the ipad. My library on the ipad is 4 gigs bigger than the ipad anyway.

    I have a 16gig ipad. I want to get rid of quite a bit of stuff that I have purchased to create space because I can't sync with my itunes library on my laptop. I dont know how to delete from the ipad. Can anyone help please? Terry

    Typically you can delete content on the iPad one of two ways - swipe across an item in list view to bring up a red delete button or tap and hold down on an icon to bring up an X to delete option.
    Why dont you connect your iPad to your laptop and transfer the purchases and then select exactly what you want to sync to the iPad. You don't have to delete anything this way.
    Transfer purchases.
    http://support.apple.com/kb/HT1848

  • My computer was stolen a few months ago i now have a new laptop with new id but don't know how to retrieve my itunes account for i forgot my old id. How can i get to my account?

    My computer was stolen several months ago and I now have a new laptop with a new id but I do not know how to retrieve my itunes account for i have forgotten my password and user id. I need a way to get into my old account.

    http://iforgot.apple.com
    Regards.

  • On Firefox 22 suddenly the box next to my emails to delete multiple emails disappeared. It works with Safari. I don't know what happened!

    My Yahoo email page suddenly lost the check box next to the emails to delete multiples or do any other action in multiples. I can't find any way to get it back. I have Firefox 22. yahoo email works fine on Safari.

    Hello,
    The Reset Firefox feature can fix many issues by restoring Firefox to its factory default state while saving your essential information.
    Note: ''This will cause you to lose any Extensions, Open websites, and some Preferences.''
    To Reset Firefox do the following:
    #Go to Firefox > Help > Troubleshooting Information.
    #Click the "Reset Firefox" button.
    #Firefox will close and reset. After Firefox is done, it will show a window with the information that is imported. Click Finish.
    #Firefox will open with all factory defaults applied.
    Further information can be found in the [[Reset Firefox – easily fix most problems]] article.
    Did this fix your problems? Please report back to us!
    Thank you.

  • I need help with this method, i don't know how to call it correct.

    public void method397(byte byte0, int i)
            if(byte0 != 6)
                for(int j = 1; j > 0; j++);
            aByteArray1405[anInt1406++] = (byte)(i + cacheMod.method246());
        }This code is for a Game client im making for a 2dmmorpg, the method was refactored by a friend but he isn't online at the moment because his on holiday; This method sends a packet to the server, i have handled it in the server;
    So i would think you would call it like this;
    super.engineStream.method397((byte)6, 103);But that gives me a huge exception, so please could someone explain how i could fix?
    Thanks
    Ill get the error in a second.

    Exception in thread "AWT-EventQueue-0" java.lang.NullPointerException
            at Gui.ClientStreamLoader(Gui.java:328)
            at Gui.actionPerformed(Gui.java:323)
            at javax.swing.AbstractButton.fireActionPerformed(Unknown Source)
            at javax.swing.AbstractButton$Handler.actionPerformed(Unknown Source)
            at javax.swing.DefaultButtonModel.fireActionPerformed(Unknown Source)
            at javax.swing.DefaultButtonModel.setPressed(Unknown Source)
            at javax.swing.AbstractButton.doClick(Unknown Source)
            at javax.swing.plaf.basic.BasicMenuItemUI.doClick(Unknown Source)
            at javax.swing.plaf.basic.BasicMenuItemUI$Handler.mouseReleased(Unknow
    Source)
            at java.awt.Component.processMouseEvent(Unknown Source)
            at javax.swing.JComponent.processMouseEvent(Unknown Source)
            at java.awt.Component.processEvent(Unknown Source)
            at java.awt.Container.processEvent(Unknown Source)
            at java.awt.Component.dispatchEventImpl(Unknown Source)
            at java.awt.Container.dispatchEventImpl(Unknown Source)
            at java.awt.Component.dispatchEvent(Unknown Source)
            at java.awt.LightweightDispatcher.retargetMouseEvent(Unknown Source)
            at java.awt.LightweightDispatcher.processMouseEvent(Unknown Source)
            at java.awt.LightweightDispatcher.dispatchEvent(Unknown Source)
            at java.awt.Container.dispatchEventImpl(Unknown Source)
            at java.awt.Component.dispatchEvent(Unknown Source)
            at java.awt.EventQueue.dispatchEvent(Unknown Source)
            at java.awt.EventDispatchThread.pumpOneEventForFilters(Unknown Source)
            at java.awt.EventDispatchThread.pumpEventsForFilter(Unknown Source)
            at java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source)
            at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
            at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
            at java.awt.EventDispatchThread.run(Unknown Source)

  • HELP-New PC-d/loaded latest iT-don't know how to get library from old PC

    Got myself a new computer. Downloaded the latest version of iTunes (7.6.2.9). On my old PC, I had a large music collection. I took copies of the iTunes folder in My Music and re-installed it in MyMusic on my new PC hoping that the new iTunes would pick up my library and settings but it didn't.
    I'm obviously doing something wrong - I'd really appreciate some help here 'cos it's far too quiet!!

    Go on your old computer and go to my music/itunes then stick the file Itunes Library.xml on a disk or flash drive. Put that file on your computer and open itunes. Go to file/import then go to wherever you saved the file and your library should open. otherwise, back the other one up to discs and import it.
    --cassie

  • I'm an idiot with a 5G IPod  don't know how to use iSquint for Videos

    if I had know that I had to convert all my videos , which I have no idea on how to do it , I wouldn't have bought it . I've been reading the forums and downloaded iSquint . I click convert file optimize for iPod and automatically add to iTunes . The video shows up in iTunes in the video folder and play in the selected song box in the lower right hand corner in the iTunes , I've been trying to drag and drop them on to my iPod in the source list in iTunes but no luck , how do I get the videos onto my iPod . Thanks all .
    Clarice

    It sounds like you're going about it the right way. I also used iSquint for short videos. Handbrake is the program you want for converting DVDs.
    Are you converting MPEGs? DVDs? AVIs?
    You said they're going into iTunes correctly and play in iTunes. That's a major hurdle. So what happens when you select your video and drag it toward the video ipod in the menu bar? When you drag the video on top of your ipod's name (on the left hand Source menu bar) does it change to a plus sign? Do you get an error message when you attemp to move the files?
    Is your iPod up to date on the software? Is your iTunes the most recent version?
    More details on your problem would help us figure out the solution. Of course you can always take it to your local Apple store where they are MORE than happy to help you.

  • HT200131 I am trying to enter my network password and when I have entered the password for my network, I don't know how to get the remote to select submit.  Please help

    I bought an apple tv some time back and am only now trying to set up the wireless internet connection.  I can see my network but when I enter the password with the remote, I don't know how to get the remote to submit the password.  Could you please tell me what to do?

    You have to use the right arrow on the remote to navigate all the way and highlight the submit button.

  • Please help I don't know how to verify my apple I'd so I can download facebook

    Please help me verify my apple Id I don't know how or where to go

    Missy 143 wrote:
    Please help me verify my apple Id I don't know how or where to go
    See your other post on this Topic >  Help please

  • I don't know how to manage my beats audio sound on Envy 4-1035TU

     Hello, 
    I really need help to fix this problem. 
    I don't know how to set the Beats Audio setting.
    I can't have a video call with my friends, my video cam did not work, my microphone too.
    I tried to change certain part, but end up worst.
    the sound become mute. 
    Even a song played form the media player can't even be heard !
    Can somebody help me ? :'(

    Go to the link below to access your support page. Download & Save the latest Audio driver. Next go into Control Panel,Programs & Features-uninstall IDT software.Restart the laptop and install using the downloaded file.
    http://h10025.www1.hp.com/ewfrf/wc/softwareCategory?os=4063&lc=en&cc=us&dlc=en&sw_lang=&product=5277...
    ******Clicking the Thumbs-Up button is a way to say -Thanks!.******
    **Click Accept as Solution on a Reply that solves your issue to help others**

  • Don't know how to input mp3 to my iphone after updated itunes

    don't know how to input mp3 to my iphone after updated itunes, the left panel is missing now. also some of the mp3 do not file under the same folder with same artist name, don't know how to use the filing system now. pls help. thanks.

    Media is synced the same way in the current version that it was synced in every previous version of iTunes.
    Select the device.
    Select the content desired to be synced.
    Sync.
    To enable the side bar type Cntrl + S

  • I have downloaded MAMP for Mac and want to use it for working with Wordpress. I had mysql installed before this and would like to uninstall it and use MAMP. It was easy to turn off Apache and PHP but don't know how to uninstall mysql. Please help!!

    I have downloaded MAMP for Mac and want to use it for working with Wordpress. I'm on an Imac with Maverick OS 10.9. I had mysql installed before this and would like to uninstall it and use MAMP. It was easy to turn off Apache and PHP but don't know how to uninstall mysql. Please help!!

    It depends on how you installed it. You have to shutdown the MySQL service first. If you used the standard, but obsolete Startup Item, you can do that with the Startup Item. If you created a launchd script, you can do it with launchctl. Once MySQL is no longer running, you can delete the Startup Item or launchd script and the rest of MySQL.

Maybe you are looking for

  • To get working day

    Hi Gurus,      my requirement is to get a working day. I know how many days my work will take to finish i.e no of days, let us say 10 days I need to add these number of working days to the system date excluding the weekend days.i.e I need to add 10 w

  • Does the Catalyst 2960x-48TD support Cisco's IGMP Snooping MIB?

    Does the Catalyst 2960x-48TD support Cisco's IGMP Snooping MIB?  We have a number of switches from different vendors and have recently begun switching to Cisco's, however unlike the other brands I am unable to audit the IGMP Snooping settings via SNM

  • Keyboard command-b works, return to plain text via command-t doesnt work

    I am helping my Dad out here, we have figured out a couple of glitches he is having using the Word Processing thanks to Discussions. The last thing we cannot figure out is that he has been used to typing keyboard command-b, then a string of bold word

  • How to install the Solairs 9 without change my existing partition?

    I got 2 partitions on my hard drive: 1)Primary partition, running Win2000, occupied 40% of my hard drive. 2)Ext partition, which divided into two drives E & F. I want to install the Solaris 9 on the E drive with out change to other drives(C,F). Q1: W

  • Can't open CS5

    Some help please. I just installed Mac 10.7.1 Lion. Everything went well, but . . .   When I try to open PS CS5 v12.0.4 the splash banner comes up, a second or two later I get a message box saying "Could not open a scratch file because the disk is no