Button, or other panel related question

so, if any of you have read my previous topic about painting rectangles in a panel, that worked great, but now i need to mkae those rectangles components so that when someone hovers over it or clicks on it it displays information at a certain area. I know how to make listeners and how to add buttons in a panel, BUT how do I add buttons at a specific coordinate. This program graphs data on a specific scale and therefore adding a button in the approximate area using a grid layout will not be good enough. Is there anyway for me to place the the button/component/object at the extact location that I want?
thanks in advance

In future GUI related questions should be posted in the appropriate GUI forum (likely Swing).
so, if any of you have read my previous topic about
painting rectangles in a panel, that worked great,
but now i need to mkae those rectangles components so
that when someone hovers over it or clicks on it it
displays information at a certain area. What?

Similar Messages

  • Backup VHD size is much more than expected and other backup related questions.

    Hello,I have few windows 2008 server and i have scheduled the weekly backup (Windows Backup) which runs on saturday.
    I recently noticed that the actual size of the data drive is only 30 GB but the weekly backup creates a VHD of 65 GB.This is not happening for all servers but for most of the server.Why is it so..and how can i get the correct VHD size..60 GB VHD does't make
    sence for 30 GB data.
    2. If any moment of time if i have to restore entire Active Directory on windows 2008 R2 then is is the process same as windows 2003..means going to DSRM mode,restoring the backup,authoritative restore or is there any difference..
    3. I also noticed that if i have a backup VHD of one server (Lets Say A) and if i copy that Backup to other server (Let Say B) then windows 2008 only gives me an option to attach the VHD to server B but through backup utlity is there any way to restore the
    data from the VHD,Currently i am doing copy paste from VHD to server B data drive but  that is not the correct way of doing it..Is it a limitation of windows 2008?
    Senior System Engineer.

    Hi,
    If there are large number of files getting deleted on the data drive, the backup image can have large holes. You can compact the vhd image by using diskpart command to the correct VHD size.
    For more detaile information, please refer to the thread below:
    My Exchange backup is bigger than the used space on the Exchange drive.
    https://social.technet.microsoft.com/Forums/windowsserver/en-US/3ccdcb6c-e26a-4577-ad4b-f31f9cef5dd7/my-exchange-backup-is-bigger-than-the-used-space-on-the-exchange-drive?forum=windowsbackup
    For the second question, the answer is yes. If you want to restore entire Active Directory on windows 2008 R2, you need to start the domain controller in Directory Services Restore Mode to perform a nonauthoritative restore from backup.
    Performing Nonauthoritative Restore of Active Directory Domain Services
    http://technet.microsoft.com/en-us/library/cc816627(v=ws.10).aspx
    If you want to restore a backup to server B which is created on server A, you need to copy the WindowsImageBackup folder to server B.
    For more detailed information, please see:
    Restore After Copying the WindowsImageBackup Folder
    http://standalonelabs.wordpress.com/2011/05/30/restore-after-copying-the-windowsimagebackup-folder/
    Best Regards,
    Mandy
    Please remember to mark the replies as answers if they help and unmark them if they provide no help. If you have feedback for TechNet Subscriber Support, contact [email protected]

  • Any value in the Rapid Charger? and other charge related questions

    Ok, I think I have calmed down. I will keep my playbook.  But some issues still continue to burn me.   The lastest, the time to recharge off the provided wall-charger.
    - So does anyone here have the Rapid charger? Does it really work faster than the wall-charger?
    - WIll the playbook charge off a PC USB connection?
    - Will the Playbook charge off a standard 9700 or 9800 charger? 
    thanks
    8100, 8900, 9800, and Playbook owner

    paulypaul wrote:
    - So does anyone here have the Rapid charger? Does it really work faster than the wall-charger?
    The provided wall charger works pretty fast for me, I was actually surprised how quick.
    - WIll the playbook charge off a PC USB connection?
    Yes, slowly. Much slower than the provided charger.
    - Will the Playbook charge off a standard 9700 or 9800 charger? 
    Ditto. Yes, slowly. Much slower than the provided charger.
    1. If any post helps you please click the below the post(s) that helped you.
    2. Please resolve your thread by marking the post "Solution?" which solved it for you!
    3. Install free BlackBerry Protect today for backups of contacts and data.
    4. Guide to Unlocking your BlackBerry & Unlock Codes
    Join our BBM Channels (Beta)
    BlackBerry Support Forums Channel
    PIN: C0001B7B4   Display/Scan Bar Code
    Knowledge Base Updates
    PIN: C0005A9AA   Display/Scan Bar Code

  • How can I use the button in one panel to control the other panel's appearing and disappearing?

    How can I use the button in one panel to control the other panel's
    appearing and disappearing? What I want is when I push the button on
    one button . another panel appears to display something and when I
    push it again, that the second panel disappears.

    > How can I use the button in one panel to control the other panel's
    > appearing and disappearing? What I want is when I push the button on
    > one button . another panel appears to display something and when I
    > push it again, that the second panel disappears.
    >
    You want to use a combination of three features, a button on the panel,
    code to notice value changes using either polling in a state machine of
    some sort or an event structure, and a VI Server property node to set
    the Visible property of the VI being opened and closed.
    The button exists on the controlling panel. The code to notice value
    changes is probably on the controlling panel's diagram, and this diagram
    sets the Visible property node of a VI class property node to FALSE or
    TRUE to show or
    hide the panel. To get the VI reference to wire to the
    property node, you probably want to use the Open VI Reference node with
    the VI name.
    Greg McKaskle

  • Buttons showing in panel help

    HI,
    This was my final year project and im trying to tidy it up a bit so I can add it to my protfolio but im having a big problem with the following:
    I have several panels all in a container, one is a button panel and one is a screen which shows an algorithm running. When you press or hover over a button in the button panel, it is displayed in the top left corner of the screen panel.
    the applet is here: http://homepage.ntlworld.com/k.wood143/FinalCopy/algo.html
    to get to the source just take off algo.html
    the classes you want are algoApp.java, and /runjava/GrahamScan.java
    any help or questions will be greatly appreciated, thanks in advance

    this edited version of your code does not show the buttons in the panel. The problem was your incorrect implementation of JPanels. You should never override paint(..) but paintComponent(..) instead. your implementation would have been ok for AWT but not Swing. get rid of all of your update and paint functions. put your 'update' code in paintComponent() save the call to repaint(). The DefaultPoints Panel is unnecessary. here is a revision of GrahamScan:
    package runjava;
    * Author Paul wood
    * This class is a JPanel used to display all of the steps
    * involved in the Grahams Scan algorithm. It addds an animation
    * feature to the JPanel using threads
    import javax.swing.JOptionPane;
    import javax.swing.*;
    import javax.swing.event.*;
    import java.awt.*;
    import java.awt.event.*;
    import java.awt.geom.*;
    public class GrahamScan extends JPanel implements Runnable {
         //Edited by BlairTheMagician
         static int[][]coords = new int[][]{ {20, 90}, {100, 140}, {25, 200}, {150, 140},
                        {120, 220}, {115, 200}, {150, 55}, {125, 120},
                        {200, 140}, {250, 210},{220, 265}, {240, 240} };
         // Create an array of type Point
         static Point[] defaultPoints = new Point[coords.length];
         static
              //     add the points of the coords 2d array into the point array
             for(int i = 0; i < defaultPoints.length; i++)
                 defaultPoints[i] = new Point(coords[0],coords[i][1]);
         }// end edit by the Magician
    // initialise constants used for button presses
    public final static int COMPLETE = 1;
    public final static int ANCHOR = 2;
    public final static int ANGLE = 3;
    public final static int CONVEX = 4;
    public final static int ANIMATION = 5;
    public final static int STOPANIM = 6;
    public final static int STEP = 7;
    public final static int BUILD = 8;
    private int complete;
    private int anchor;
    private int angle;
    private int build;
    private int convex;
    private int step;
    private int nextStep;
    Point test1;
    Point test2;
    // these are used to get the sets of points
    DefaultPanel defaultPanel;
    OwnPointsDemo ownPointsPanel;
    Point[] points;
              // this is still not workink
    //Point[] points = ownPointPanel.points;
    int draw = 2;
    int count = 2;
    int val = 0;
    int[][] lineDraw;
    boolean completeHull = false;
    int start = 0;
    // default delay
    int delay = 1000;
    // animation stuff
    int frameNumber = 0;
    volatile Thread animatorThread = null;
    boolean threadSuspended = false;
         // create an array to hold the final convex hull points
         Point[] convexHull;
         ArrayStack S;
    public GrahamScan(DefaultPanel defaultPanel, OwnPointsDemo ownPointsPanel )
    // add demo panel
    // JPanel grahamScanPanel = new JPanel();
    this.defaultPanel = defaultPanel;
    this.ownPointsPanel = ownPointsPanel;
    points = defaultPanel.points;
    convexHull = new Point[points.length];
         S = new ArrayStack(points.length);
    //Point[] points = ownPointPanel.points;
    lineDraw = new int[points.length][points.length];
    public void startAnimation()
    //Create and start the animating thread.
              if (animatorThread == null) {
                   animatorThread = new Thread(this);
                   animatorThread.start();
    public void stopAnimation() {
    //Stop the animating thread.
    if (animatorThread != null) {
                   animatorThread = null;
         public void run()
              final Thread currentThread = Thread.currentThread();
              reset();
              step = STEP;
              while( animatorThread == currentThread) {
                   try{
                        currentThread.sleep(delay);
                        synchronized(this) {
                             while (threadSuspended && animatorThread == currentThread)
                                  wait();
                   }catch( InterruptedException ex ){}
                   frameNumber++;
                   nextStep++;
                   repaint();
    public void paint( Graphics g )
         update(g);
         public void paintComponent( Graphics g )
         Graphics2D g2 = (Graphics2D)g;
    //super.paint( g2 );
         g2.setColor(Color.white);
         g2.fillRect(0,0,this.getWidth(),this.getHeight());
         g2.setColor(Color.black);
         // edit by BTM begin
         // draw default points
         for(int i = 0; i < defaultPoints.length; i++)
    g2.fillOval( defaultPoints[i].x, defaultPoints[i].y, 4, 4 );
         // end edit by BTM
    // initialise a polygon for visual testing of the algorithm
    Polygon polygon1 = new Polygon();
    g2.drawString("frame = " + frameNumber, ( 200 ),( 300 ) );
    if( anchor == ANCHOR )
              // now start the algoithm by finding the anchor point
              findAnchorPoint();
              g2.setColor(Color.blue);
              g2.drawString("<-- Anchor point", ( points[0].x + 5 ),( points[0].y +5 ) );
         if( angle == ANGLE )
              // next sort the array into angular order
              angleSort( points );
              for(int i = 1; i < points.length; i++)
              g2.drawLine(points[0].x, points[0].y, points[i].x, points[i].y );
    if( step == STEP )
              g2.drawString("step = " + nextStep, ( 100 ),( 300 ) );
              if( nextStep == 1 )
                   anchor(ANCHOR);
                   // this is needed to stop the image being repainted until
                   // step is pressed again
                   nextStep++;
              else if( nextStep == 3 )
                   angle( ANGLE );
              // this is needed to stop the image being repainted until
                   // step is pressed again
                   nextStep++;     
              else if( nextStep == 5 )
                        buildConvex( BUILD );
                        // this is needed to stop the image being repainted until
                   // step is pressed again
                   nextStep++;      
    if( build == BUILD )
         convexHull( points );
                   if (completeHull == true)
                        // add the points in the point array to the polygon
         for ( int i = 0; i < convexHull.length && convexHull[ i ] != null; i++ )
         polygon1.addPoint( convexHull[ i ].x, convexHull[ i ].y );
         // draw the polygon
         g2.drawPolygon( polygon1 );
    else
    //     g2.drawLine(points[0].x, points[0].y, points[1].x, points[1].y);
         test1 = S.top();
                        test2 = S.secTop();
                        if( val < 1 )
                             lineDraw[0][0] = points[0].x;
                             lineDraw[0][1] = points[0].y;
                        //     lineDraw[1][0] = points[1].x;
                        //     lineDraw[1][1] = points[1].y;
                             lineDraw[1][0] = test2.x;
                             lineDraw[1][1] = test2.y;
                             lineDraw[2][0] = test1.x;
                             lineDraw[2][1] = test1.y;
                             val++;
                        if(test1.x == lineDraw[draw][0] && test1.y == lineDraw[draw][1] )
                             //just draw what we've already got
                             for( int i = 1; i < lineDraw.length && lineDraw[i][0] > 0; i++ )
                                  g2.setColor( Color.blue );
                                  g2.drawLine(lineDraw[i-1][0], lineDraw[i-1][1], lineDraw[i][0], lineDraw[i][1] );
                        else
                             //add to lineDraw then draw lines
                             lineDraw[draw][0] = test1.x;
                             lineDraw[draw][1] = test1.y;
                             lineDraw[draw][0] = test2.x;
                             lineDraw[draw][1] = test2.y;
                             for( int i = 1; i < lineDraw.length && lineDraw[i][0] > 0; i++ )
                                  g2.setColor( Color.blue );
                                  g2.drawLine(lineDraw[i-1][0], lineDraw[i-1][1], lineDraw[i][0], lineDraw[i][1] );
         g2.setColor( Color.red );     
                        g2.drawLine(test1.x, test1.y, test2.x, test2.y);
    if( convex == CONVEX )
         // finally find which points are on the convex hull
              testMeth( points );
    // add the points in the point array to the polygon
    for ( int i = 0; i < convexHull.length && convexHull[ i ] != null; i++ )
    polygon1.addPoint( convexHull[ i ].x, convexHull[ i ].y );
    // draw the polygon
    g2.setColor(Color.blue);
    g2.drawPolygon( polygon1 );
    // these next methods all relate to button presses in he main AlgoApp class
    public void anim ( int animation )
         convex = 0;
         angle = 0;
         anchor = 0;
         if( animation == ANIMATION )
              threadSuspended = false;
    startAnimation();
         else if( animation == STOPANIM )
              threadSuspended = true;
    stopAnimation();
    public void anchor ( int anchorPoint )
         convex = 0;
         angle = 0;
         anchor = anchorPoint;
         repaint();
    public void angle ( int angleSort )
         convex = 0;
         angle = angleSort;
         repaint();
    public void step ( int stepByStep )
         convex = 0;
         step = stepByStep;
         nextStep++;
         repaint();
    public void buildConvex( int buildHull )
         angle = 0;
         build = buildHull;
         repaint();
    public void convex ( int convexHull )
         angle = 0;
         convex = convexHull;
         repaint();
    public void sliderValue( int slider )
         delay = slider;
    public void reset()
         complete = 0;
         anchor = 0;
         angle = 0;
         build = 0;
         convex = 0;
         step = 0;
         nextStep = 0;
         frameNumber = 0;
         start = 0;
         draw = 2;
         count = 2;
         val = 0;
         completeHull = false;
         // used to delete lineDraw array so it redraws from the start
         for( int i = 0; i < lineDraw.length; i++)
              lineDraw[i][0] = 0;
              lineDraw[i][1] = 0;
         repaint();
    *This is where Graham's Scan algorithm is
    // first we find the anchor point
    public void findAnchorPoint()
    int min = points[0].y;
    int max = points[0].x;
    int anchorPoint = 0;
    int anchorIndex = 0;
    for (int i = 0; i < points.length && points[i] != null; i++)
    if (points[i].y > min)
    min = points[i].y;
    max = points[i].x;
    anchorPoint = i;
    else if (points[i].y == min)
    if (points[i].x > max)
    min = points[i].y;
    max = points[i].x;
    anchorPoint = i;
    // puts the anchor point at the beginning of the array
    swapPoint( points, anchorPoint, anchorIndex );
    public void swapPoint( Point pointArray[], int first, int second )
    Point hold;
    hold = pointArray[ first ];
    pointArray[ first ] = pointArray[ second ];
    pointArray[ second ] = hold;
    public void swapDouble( double doubleArray[], int first, int second )
    double temp;
    temp = doubleArray[ first ];
    doubleArray[ first ] = doubleArray[ second ];
    doubleArray[ second ] = temp;
    public double[] arraySort(double sortArray[])
    for( int pass = 0; pass < sortArray.length; pass++)
    for(int i = 2; i < sortArray.length; i++)
    if(sortArray[i] > sortArray[i-1] )
    swapPoint(points, i, i-1);
    swapDouble(sortArray, i, i-1);
    return sortArray;
    // next we calculate the angles
    public void angleSort( Point arr2[] )
    double angleArray[] = new double[arr2.length];
    double orderArray[] = new double[arr2.length];
    int indexOfAngle = 0;
    // works out angle of every point with x0 and y0 as the anchor point
    for (int i = 0; i < arr2.length; i++) {
    double pointAngle = Math.atan2((arr2[i].y - arr2[0].y), (arr2[ i ].x - arr2[0].x));
    // if its on the line with the anchor point at 180 degrees, this equals PI.
    // to make this come last in the array change PI to minus PI
    if ( pointAngle == Math.PI)
    pointAngle = -Math.PI;
    angleArray[i] = pointAngle;
    // call sortArray to sort the array angularly
    orderArray = arraySort(angleArray);
         // finally we claculate the final convex hull
    public void convexHull(Point stackArr[] )
    float leftCheck;
    if ( start == 0 )
              S.push(stackArr[0]);
              S.push(stackArr[1]);
              start += 1;
         if ( draw < stackArr.length )
              Point pt1 = S.top();
              Point pt2 = S.secTop();
              leftCheck = isLeft(pt1,pt2,stackArr[draw]);
              if ( leftCheck > 0)
                   S.push(stackArr[draw]);
                   count++;
                   draw++;
              else
              S.pop();
              count--;
         if ( draw == stackArr.length )
    completeHull = true;
              // stack called temp is used to get elements output in the correct order
              ArrayStack temp = new ArrayStack(stackArr.length);
              for ( int counter = 0; counter < count; counter++ )
              Point tempPoint = S.pop();
              temp.push(tempPoint);
              // put the coordinate onto final convex hull array
              for (int j = 0; j < count; j++)
              convexHull[j] = temp.pop();
              draw++;
    // this testMeth is used to allow the Get Convex Hull button to work
    public void testMeth(Point stackArr[] )
    int count = 2;
    int i = 2 ;
    float leftCheck;
    ArrayStack S = new ArrayStack(stackArr.length);
    S.push(stackArr[0]);
    S.push(stackArr[1]);
    while ( i < stackArr.length)
    Point pt1 = S.top();
    Point pt2 = S.secTop();
    leftCheck = isLeft(pt1,pt2,stackArr[i]);
    if ( leftCheck > 0)
    S.push(stackArr[i]);
    count++;
    i++;
    else
    S.pop();
    count--;
    // stack called temp is used to get elements output in the correct order
    ArrayStack temp = new ArrayStack(stackArr.length);
    String testOutput = "\nConvex Hull = \n ";
    for ( int counter = 0; counter < count; counter++ )
    Point tempPoint = S.pop();
    temp.push(tempPoint);
    // put the coordinate onto final convex hull array
    for (int j = 0; j < count; j++)
    convexHull[j] = temp.pop();
    //==============================================================================
    // Copyright 2001, softSurfer (www.softsurfer.com)
    // This code may be freely used and modified for any purpose
    // providing that this copyright notice is included with it.
    // SoftSurfer makes no warranty for this code, and cannot be held
    // liable for any real or imagined damage resulting from its use.
    // Users of this code must verify correctness for their application.
    // This is a C++ implementation which I, Paul Wood have modified slighty
    // for use in Java (07/03/2005).
    // isLeft(): tests if a point is Left|On|Right of an infinite line.
    // Input: three points P0, P1, and P2
    // Return: >0 for P2 left of the line through P0 and P1
    // =0 for P2 on the line
    // <0 for P2 right of the line
    public float isLeft( Point P0, Point P1, Point P2 )
    return (P1.x - P0.x)*(P2.y - P0.y) - (P2.x - P0.x)*(P1.y - P0.y);
    //==============================================================================

  • Laying out buttons in a panel

    I have a panel with 4 buttons. The panel is added to the main window using BorderLayout.SOUTH so that the buttons are at the bottom of the window. Now I want to align the buttons on the right side of the panel, like so:
    | |
    | ----- ----- ----- ----- |
    | | b1| | b2| | b3| | b4| |
    | ----- ----- ----- ----- |
    | |
    The obvious thing to do here is use
    myPanel.setAlignmentX(Component.RIGHT_ALIGNMENT);
    But it doesn't work. Any suggestions are greatly appreciated.
    Jason

    Any idea why the
    panel.setAlignmentX(Component.RIGHT_ALIGNMENT)
    wouldn't do the trick?Because the panel is using a BorderLayout. Any inherent behavior specified by the panel would be overshadowed by the behavior specified by the BorderLayout layout manager.
    By the way you also asked a component alignment question here: http://forum.java.sun.com/thread.jsp?forum=57&thread=352465
    If any of the replies answered your question then you should award the duke dollar.

  • Deafult search engine on a new tab-this thread was closed but I have a related question. Once you put the new url in, what then? Close? When tried, did not work

    "deafult search engine on a new tab" - this thread was closed but I have a related question. [the word “default” is spelled as it on the thread] Once you put the new url in, what then? Close it? When tried, it did not work. The closest answer is noted here. Instructing to go to about:fig. Specifically, I installed the accuweather add=on and it took over my tab home page - the one that comes up when you click for a new tab. I didn't like it so I clicked the button to remove it and the page went blank. I searched to see out to restore the tab page, tired the reply at this page :
    http://support.mozilla.org/en-US/questions/753256?s=install+search+box+on+new+tabs&r=3&as=s
    But it did not work. Can some on help me? Just want to know how to make google or some page open on a new tab.
    Many thanks

    Thanks so much for your support. As I said I am not a professional, so I by chance saw a friend who is and this is what he suggested and it worked.
    We googled for an answer and found this site: http://www.guidingtech.com/8004/have-new-tab-page-open-specific-website-firefox-chrome/
    It says to Download and install Download and install''' NewTabURL''' and gives instructions on how to. Now when I open the tab it goes to my preferred search page!

  • HT5312 I am trying to reset my security questions, I cannot locate the option for a rescue email address with My Apple Id. When I click on the button to reset the security questions, it states it is sending an email to the primay email address, but it doe

    I am trying to reset the Security Questions as I have forgotten them, when I have logged into My Apple Id, and click on the button to reset the Security Questions, it states it is sending an email to the Primary Email address. I do not have the option to input a Rescue Email address, the only option I have is to input an Alternate Email address, which I have done so.
    Also when I have tried to book an appointment throuth Online Support, I have not successful, I have rung a telephone number provided by the Mac Store in Perth, Australia and the reply provided is that we are closed. I was given to understand that Apple provided 24/7 Support to their users.

    Hot N Spicy wrote:
    I am trying to reset the Security Questions as I have forgotten them,
    Forgotten Security Questions / Answers...
    See Here > Apple ID: Contacting Apple for help with Apple ID account security
              Ask to speak with the Account Security Team...
    Or Email Here  >  Apple  Support  iTunes Store  Contact
    More Info >  Apple ID: All about Apple ID security questions
    Note:
    You can only set up and/or change a Rescue Email Before you forget the questions/answers

  • How can I copy a button to a panel?

    I am working on this project where I have 3 buttons that need to be dragged to a panel. I have created a new TransferHanndler that can support dropping to a panel. Now I have to figure out to actually copy an image of that button to the panel wherever the mouse position is, and be able to move it around in that panel and change its position.
    Here is what I have so far:
    import java.awt.event.MouseAdapter;
    import java.awt.event.MouseEvent;
    import java.awt.event.MouseListener;
    import javax.swing.JButton;
    import javax.swing.JComponent;
    import javax.swing.TransferHandler;
    * DNDApplet.java
    * Created on June 10, 2008, 4:11 PM
    * @author  Evie
    public class DNDApplet extends javax.swing.JApplet {
        /** Initializes the applet DNDApplet */
        public void init() {
            try {
                java.awt.EventQueue.invokeAndWait(new Runnable() {
                    public void run() {
                        initComponents();
                        initHandlers();
            } catch (Exception ex) {
                ex.printStackTrace();
        public void initHandlers(){
            MouseListener listener = new DragMouseAdapter();
            jButton1.addMouseListener(listener);
            jButton2.addMouseListener(listener);
            jButton3.addMouseListener(listener);
            JButton buttonClone = new JButton();
            jButton1.setTransferHandler(new ButtonTransferable("hello"));
            jButton2.setTransferHandler(new ButtonTransferable("hello2"));
            jButton3.setTransferHandler(new ButtonTransferable("hello3"));
            jPanel1.addMouseListener(listener);
            jPanel1.setTransferHandler(new ButtonTransferable("goodbye"));
            //jEditorPane1.setDragEnabled(true);
            //jEditorPane1.setTransferHandler(new TransferHandler("text"));
            //jButton2.setTransferHandler(new TransferHandler("text"));
            //label2.setTransferHandler(new TransferHandler("icon"));
        /** This method is called from within the init() method 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() {
            jButton1 = new javax.swing.JButton();
            jButton2 = new javax.swing.JButton();
            jButton3 = new javax.swing.JButton();
            jPanel1 = new javax.swing.JPanel();
            jButton1.setIcon(new javax.swing.ImageIcon(getClass().getResource("/cube.gif"))); // NOI18N
            jButton1.addActionListener(new java.awt.event.ActionListener() {
                public void actionPerformed(java.awt.event.ActionEvent evt) {
                    jButton1ActionPerformed(evt);
            jButton2.setIcon(new javax.swing.ImageIcon(getClass().getResource("/sphere.gif"))); // NOI18N
            jButton3.setIcon(new javax.swing.ImageIcon(getClass().getResource("/triangle.gif"))); // NOI18N
            jPanel1.setBackground(new java.awt.Color(204, 204, 255));
            javax.swing.GroupLayout jPanel1Layout = new javax.swing.GroupLayout(jPanel1);
            jPanel1.setLayout(jPanel1Layout);
            jPanel1Layout.setHorizontalGroup(
                jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                .addGap(0, 279, Short.MAX_VALUE)
            jPanel1Layout.setVerticalGroup(
                jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                .addGap(0, 199, Short.MAX_VALUE)
            javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
            getContentPane().setLayout(layout);
            layout.setHorizontalGroup(
                layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                .addGroup(layout.createSequentialGroup()
                    .addContainerGap()
                    .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING, false)
                        .addComponent(jPanel1, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                        .addGroup(javax.swing.GroupLayout.Alignment.LEADING, layout.createSequentialGroup()
                            .addComponent(jButton1, javax.swing.GroupLayout.PREFERRED_SIZE, 77, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addGap(18, 18, 18)
                            .addComponent(jButton2, javax.swing.GroupLayout.PREFERRED_SIZE, 83, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addGap(18, 18, 18)
                            .addComponent(jButton3)))
                    .addContainerGap(111, 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(jButton3)
                        .addComponent(jButton2)
                        .addComponent(jButton1, javax.swing.GroupLayout.PREFERRED_SIZE, 61, javax.swing.GroupLayout.PREFERRED_SIZE))
                    .addGap(18, 18, 18)
                    .addComponent(jPanel1, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                    .addContainerGap())
        }// </editor-fold>
    private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {
    // TODO add your handling code here:
        // Variables declaration - do not modify
        private javax.swing.JButton jButton1;
        private javax.swing.JButton jButton2;
        private javax.swing.JButton jButton3;
        private javax.swing.JPanel jPanel1;
        // End of variables declaration
    class DragMouseAdapter extends MouseAdapter {
            public void mousePressed(MouseEvent e) {
                JComponent c = (JComponent) e.getSource();
                TransferHandler handler = c.getTransferHandler();
                handler.exportAsDrag(c, e, TransferHandler.COPY);
    And this is my transfer handler
    * To change this template, choose Tools | Templates
    * and open the template in the editor.
    * @author Evie
    import java.awt.Component;
    import java.awt.Dimension;
    import java.awt.datatransfer.DataFlavor;
    import java.awt.datatransfer.StringSelection;
    import java.awt.datatransfer.Transferable;
    import javax.swing.DefaultButtonModel;
    import javax.swing.DefaultListModel;
    import javax.swing.GroupLayout;
    import javax.swing.JComponent;
    import javax.swing.JList;
    import javax.swing.JButton;
    import javax.swing.JLabel;
    import javax.swing.JPanel;
    import javax.swing.JScrollPane;
    import javax.swing.TransferHandler;
    public class ButtonTransferable extends TransferHandler {
        private int[] indices = null;
        private int addIndex = -1; //Location where items were added
        private int addCount = 0;  //Number of items added.
        private String item;
        private String name;
        private JButtonX comp;
        //private BufferedImage thumb;
        private String thumb;
        public ButtonTransferable (String s) {
            //this.comp = (JButtonX)c;
            JButtonX newButton = new JButtonX();
            this.comp = newButton;
        ButtonTransferable(String s, String s0) {
            throw new UnsupportedOperationException("Not yet implemented");
         * We only support importing strings.
        public boolean canImport(TransferHandler.TransferSupport info) {
            // Check for String flavor
            if (!info.isDataFlavorSupported(DataFlavor.stringFlavor)) {
                return false;
            return true;
         * Bundle up the selected items in a single list for export.
         * Each line is separated by a newline.
        protected Transferable createTransferable(JComponent c) {
            //JList list = (JList)c;
            JButton button = (JButton) c;
            //indices = list.getSelectedIndices();
            name = button.getName();
            //Object[] values = list.getSelectedValues();
            StringBuffer buff = new StringBuffer();
            /*for (int i = 0; i < values.length; i++) {
                Object val = values;*/
    buff.append("The button was transferred");
    /*if (i != values.length - 1) {
    buff.append("\n");
    return new StringSelection(buff.toString());
    * We support both copy and move actions.
    public int getSourceActions(JComponent c) {
    return TransferHandler.COPY_OR_MOVE;
    * Perform the actual import. This demo only supports drag and drop.
    public boolean importData(TransferHandler.TransferSupport info) {
    if (!info.isDrop()) {
    return false;
    System.out.println("I imported a string");
    JPanel panel = (JPanel)info.getComponent();
    //DefaultModel listModel = (DefaultListModel)list.getModel();
    //JList.DropLocation dl = (JList.DropLocation)info.getDropLocation();
    //int index = dl.getIndex();
    //boolean insert = dl.isInsert();
    // Get the string that is being dropped.
    Transferable t = info.getTransferable();
    String data;
    try {
    data = (String)t.getTransferData(DataFlavor.stringFlavor);
    catch (Exception e) { return false; }
    /***Declaring new JButton variables**/
    JButton jb = new javax.swing.JButton();
    jb.setIcon(new javax.swing.ImageIcon(getClass().getResource("/cube.gif"))); // NOI18N
    /*//clone
    JButtonX cloneLab = null;
    cloneLab = (JButtonX)comp.clone();
    cloneLab.setName("clonebtn");
    cloneLab.setToolTipText("clonebtn");
    cloneLab.setVisible(true);
    panel.add(cloneLab);
    javax.swing.GroupLayout jPanel1Layout = new javax.swing.GroupLayout(panel);
    panel.setLayout(jPanel1Layout);
    jPanel1Layout.setHorizontalGroup(
    jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
    .addGroup(jPanel1Layout.createSequentialGroup()
    .addContainerGap()
    .addComponent(jb)
    .addContainerGap(panel.getMousePosition().y, Short.MAX_VALUE))
    jPanel1Layout.setVerticalGroup(
    jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
    .addGroup(jPanel1Layout.createSequentialGroup()
    .addContainerGap()
    .addComponent(jb)
    .addContainerGap(panel.getMousePosition().x, Short.MAX_VALUE))
    Component compArray[] = panel.getComponents();
    int size = compArray.length;
    for(int i = 0; i < size; i++)
    System.out.println("element "+i+" is: " +compArray[i].getName());
    return true;
    * Remove the items moved from the list.
    protected void exportDone(JComponent c, Transferable data, int action) {
    JButton source = (JButton)c;
    DefaultButtonModel listModel = (DefaultButtonModel)source.getModel();
    /*if (action == TransferHandler.MOVE) {
    for (int i = indices.length - 1; i >= 0; i--) {
    //listModel.remove(indices[i]);
    indices = null;
    addCount = 0;
    addIndex = -1;
    }Edited by: hannoona on Jun 13, 2008 8:50 AM                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           

    Ok the problem was the layout in buttonTransferable.java
    Here is what was changed and it worked.
    javax.swing.GroupLayout jPanel1Layout = new javax.swing.GroupLayout(panel);
            panel.setLayout(jPanel1Layout);
            jPanel1Layout.setHorizontalGroup(
                jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                .addGroup(jPanel1Layout.createSequentialGroup()
                    .addContainerGap()
    //HERE IS WHAT WAS ADDED
                    .addGap(panel.getMousePosition().x, panel.getMousePosition().x, panel.getMousePosition().x)
                    .addComponent(jb)
                    .addContainerGap(panel.getMousePosition().y, Short.MAX_VALUE))
            jPanel1Layout.setVerticalGroup(
                jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                .addGroup(jPanel1Layout.createSequentialGroup()
                    .addContainerGap()
    //HERE IS WAT WAS ADDED AS WELL
                   .addGap(panel.getMousePosition().y, panel.getMousePosition().y, panel.getMousePosition().y)
                    .addComponent(jb)
                    .addContainerGap(panel.getMousePosition().x, Short.MAX_VALUE))
            jb.setLocation(panel.getMousePosition().x, panel.getMousePosition().y);
            jb.setToolTipText("hi. im new.");
            System.out.println("mouse x is: "+panel.getMousePosition().x);
            System.out.println("mouse y is: "+panel.getMousePosition().y);
            System.out.println("jb x is: "+jb.getX());
            System.out.println("jb y is: "+jb.getY());
            return true;

  • I want to check all functions of PCI 6534.I have read the user manual..I have some memory related questions.​Please help me for that.

    I want to check all functions of PCI 6534.I have read the user manual..I have some memory related questions.Please help me for that.
    1.)If i am using the continuous output mode.and the size of generated data is less than 32 MB.If i want to preload the memory,what should i do?I want that first of all i load all my data to onboard memory & then i want to make start the transfer between 6534 & peripheral.Is it possible?As per me it should be.Plz tell me how should i do this?I think that in normal procedure the transfer between 6534-peripheral & outputting data from pc buffer to onboard memory works parallely.But i don't want this.Is it poss
    ible?
    (2).Similarly in finite input operation(pattern I/O) is it possible to preload the memory and then i read it?Because i think that the PC memory will be loaded automatically when 6534 acquires the data and then when we use DIO read vi the pc buffer data will be transferred to application buffer.If this is true,i do not want this.Is it possible?
    (3) One more question is there if i am using normal operation onboard memory will be used bydefault right?Now if i want to use DMA and if i have data of 512 bytes to acquire.How will it work and how should i do it?Please tell me the sequence of operations.As per my knowledge in normal DMA operation we have 32 Bytes FIFO is there so after acquisition of 32 bytes only i can read it.How it will known to me that 32 bytes acquisition is complete?Next,If i want to acquire each byte separately using DMA interrupts what should i do?Provide me the name of sourse from which i can get details about onboard memory & DMA process of 6534 specifically
    (4).In 6534 pattern Input mode,if i want to but only 10 bits of data.and i don't want to waste any data line what should i do?

    Hi Vishal,
    I'll try to answer your questions as best I can.
    1) It is definitely possible to preload data to the 32MB memory (per group) and start the acquisition after you have preloaded the memory. There are example programs on ni.com/support under Example Code for pattern generation and the 6534 that demonstrate which functions to use for this. Also, if your PC memory buffer is less than 32MB, it will automatically be loaded to the card. If you are in continuous mode however, you can choose to loop using the on-board memory or you can constantly be reading the PC memory buffer as you update it with your application environment.
    2) Yes, your data will automatically be loaded into the card's onboard memory. It will however be transferred as quickly as possible to the DMA FIFO on the card and then transferred to the PC memory buffer through DMA. It is not going to wait until the whole onboard memory is filled before it transfers. It will transfer throughout the acquisition process.
    3) Vishal, searching the example programs will give you many of the details of programming this type of application. I don't know you application software so I can't give you the exact functions but it is easiest to look at the examples on the net (or the shipping examples with your software). Now if you are acquiring 512 bytes of data, you will start to fill your onboard memory and at the same time, data will be sent to the DMA FIFO. When the FIFO is ready to send data to the PC memory buffer, it will (the exact algorithm is dependent on many things regarding how large the DMA packet is etc.).
    4) If I understand you correctly, you want to know if you waste the other 6 bits if you only need to acquire on 10 lines. The answer to this is Yes. Although you are only acquiring 10 bits, it is acquired as a complete word (16bits) and packed and sent using DMA. You application software (NI-DAQ driver) will filter out the last 6 bits of non-data.
    Hope that answers your questions. Once again, the example code on the NI site is a great place to start this type of project. Have a good day.
    Ron

  • How to add a button on a panel's title bar?

    Hi,
    How can I add a button to a panel's title bar? Buttons that
    are simply added to a panel's title bar become invisible.
    -Altu

    One way is to put your button component oustide your Panel
    tag in your MXML. The set the x/y coordinates for the button so it
    is on the Panel.
    <mx:Panel x="20" y="168" width="250" height="118"
    layout="absolute"/>
    <mx:Button x="73" y="173" label="Button"/>

  • In which Board we need to post cRIO related Questions?

    sir,
         In which board do i need to post cRIO related Questions and doubts regarding my application with cRIO .Please help me previously i have posted in  motion control drives as my application is related to motor control using cRIO.bu i am not getting any reply .i couldnt find any cRIO related board in select board option.
    Solved!
    Go to Solution.

    Hi illa,
    You can post your query under the Real Time Measurement and Control
    http://forums.ni.com/t5/Real-Time-Measurement-and/bd-p/280

  • Editing radio button / check box in MC question in DesignTemplates?

    Anyone an idea, how can I change these radio button / check box in MC question in a DesignTemplates?

    Hi there
    I don't believe this aspect may be controlled by a Design Template. Probably because this is an aspect that may vary from question to question. It deals with question functionality as opposed to simple visual elements.
    If you feel strongly this should be considered as part of a Design Template function, I might suggest you put it forward to Adobe.
    Click here to visit the Wish Form/Bug Reporting Form
    Cheers... Rick
    Click here for Adobe Authorized Captivate and RoboHelp HTML Training
    Click here for the SorcerStone Blog
    Click here for RoboHelp and Captivate eBooks

  • Go button in View Panel of Query Region

    Hi,
    I have a search page uses Query Region, and query region includes Simple Search Panel and View Panel, I understand to get the id of the Go button in Simple Search Panel, the method is: queryBean.getGoButtonName().
    How can get the id of Go button in View Panel? In dev guide, it says: pageContext.getPersonalizeGoButtonName(), but this method gives compile error.There is no this method in javadoc of pageContext.
    Can you please help?
    thanks
    Lei

    Try queryBean.getPersonalizeGoButtonName()

  • JTable Blank Rows When INSERT/DELETE in other panel with same ViewObject

    Hi,
    Jdev 10.1.2
    JClient
    2 panels based on same ViewObject in same AM
    One panel with Grid UI => JTable
    Other panel with Form UI
    When I insert or delete a record in the panel with Form UI and return to the panel with JTable blank rows are displayed.
    The problem remains even after commiting before returning to JTable panel.
    When I activate the execute button in the JTable panel, the display is OK but the currency is lost.
    I suppose calling the refresh method when returning to the JTable panel should solve the problem.
    Can you please suggest me a server-side/model workaround:
    refresh (which option to use ??)
    Thanks
    Frederic
    PS I tried the workaround of thread 10.1.2 JClient binding Error. but that doesn't help.

    Same problem with default wizard generated Master-Detail Form.
    When in the detail more then 10 rows exist, the scrollbar shows that not all rows are displayed.
    If I use the scrollbar to view the last rows they are blank, in order to display them I must activate the next button one time for each additional row.
    The workaround is to enter -1 in the range size of the iterator.
    But what if the range size is 10.
    Is the blank rows display a bug?
    OR
    Must the scrolling area (size of JScrollPane) be defined according to the range size of the iterator?
    If the latter is true:
    Can somebody give me some clues on which attributes of the JScrollPane must be set (PreferredSize, MinimumSize ??) and on how to calculate this area: total width & total height if the row height for the table is set to 20?
    Your help will be appreciated
    Frederic

Maybe you are looking for