Scrollbar in Panel.....help

hi.... i have to add images(picture) in Panel .because I have to add more pictures(image), scrollbar (or JScrollPane) will require please help me how to do.
U can also help in respect of following program, Thanks.
// <applet code="AnImageApplet" width="400" height="400"></applet>
// use: >appletviewer AnImageApplet.java
import java.applet.Applet;
import java.awt.*;
import java.awt.event.*;
import java.awt.image.BufferedImage;
import java.io.*;
import javax.imageio.ImageIO;
public class AnImageApplet extends Applet
public void init()
setLayout(new BorderLayout());
add(new AnImagePanel());
public static void main( String[] args )
Applet applet = new AnImageApplet();
Frame frame = new Frame( "Image" );
frame.addWindowListener(closer);
frame.add(applet);
frame.setSize(400,400);
frame.setLocation(200,200);
applet.init();
frame.setVisible(true);
private static WindowListener closer = new WindowAdapter()
public void windowClosing(WindowEvent e)
System.exit(0);
class AnImagePanel extends Panel
BufferedImage image;
public AnImagePanel()
try
image = ImageIO.read(//"yu.jpg");
new File("images/cougar.jpg"));
catch(IOException e)
System.out.println("Read error: " + e.getMessage());
public void paint(Graphics g) {
g.drawImage(image, 20, 20, this);
}

//  <applet code="AnImageApplet" width="400" height="400"></applet>
import java.applet.Applet;
import java.awt.*;
import java.awt.event.*;
import java.awt.image.BufferedImage;
import java.io.*;
import javax.imageio.ImageIO;
public class AnImageApplet extends Applet {
    public void init() {
        setLayout(new BorderLayout());
        ScrollPane scrollPane = new ScrollPane();
        scrollPane.add(getContent());
        add(scrollPane);
    private Panel getContent() {
        Panel panel = new Panel(new GridLayout(0,2,5,5));
        panel.add(new AnImagePanel("images/cougar.jpg"));
        panel.add(new AnImagePanel("images/bclynx.jpg"));
        panel.add(new AnImagePanel("images/redfox.jpg"));
        panel.add(new AnImagePanel("images/mtngoat.jpg"));
        return panel;
    public static void main( String[] args ) {
        Applet applet = new AnImageApplet();
        Frame frame = new Frame( "Image" );
        frame.addWindowListener(closer);
        frame.add(applet);
        frame.setSize(400,400);
        frame.setLocation(200,200);
        applet.init();
        frame.setVisible(true);
    private static WindowListener closer = new WindowAdapter() {
        public void windowClosing(WindowEvent e) {
            System.exit(0);
class AnImagePanel extends Panel {
    BufferedImage image;
    public AnImagePanel(String path) {
        try {
            image = ImageIO.read(new File(path));
        } catch(IOException e) {
            System.out.println("Read error: " + e.getMessage());
    public void paint(Graphics g) {
        int x = (getWidth() - image.getWidth())/2;
        int y = (getHeight() - image.getHeight())/2;
        g.drawImage(image, x, y, this);
    public Dimension getPreferredSize() {
        return new Dimension(image.getWidth(), image.getHeight());
}

Similar Messages

  • TS3989 Mssage when opening Photo Stream on-"This file does not have a program associated with it for performing this action. Please install a program or, if one is already installed, create an association in the Default Programs control panel" Help!!!

    Mssage when opening Photo Stream on-"This file does not have a program associated with it for performing this action. Please install a program or, if one is already installed, create an association in the Default Programs control panel" Help!!!

    You are posting in the "icloud on my mac" forum, but your profile mentions Windows.  If using a mac, you need to have iphoto or aperture installed in order to receive new photos via photo stream.  If using windows, try posting in the iCloud on a PC forum.  You'll get better help there.
    https://discussions.apple.com/community/icloud/icloud_on_my_pc

  • Scrollbar in panel

    Hi,
    I want to display tree structure ina panel .
    this panel , i have created using net beans .
    i want the scrollbar to be added to the panel.
    could you please help me in getting that done.
    my code is as follows.
    Sources1 is a panel.
    tree is a JTree.
    JScrollPane scrollPane = new JScrollPane();
    scrollPane.getViewport();
    scrollPane.setPreferredSize(new Dimension(250, 80));
    scrollPane.add(tree);
    tree.add( scrollPane, BorderLayout.EAST );
    Sources1.add(tree, "West");
    this is not displaying scrollbar.
    any help is appreciated.
    regards
    hari

    tree.add( scrollPane, BorderLayout.EAST ); You don't need this line.
    Sources1.add(tree, "West");Add the scroll pane (not the tree) to the panel.

  • Can't Left Click in Flash Player Settings Panel - HELP PLEASE

    Hi and thanks for taking the time to read this. Believe me it is a fraction of the time I have wasted trying to resolve this issue.
    Basic problem is:
    I am trying to stream to Ustream but since downloading AFP11 for my Windows PC when I open the Flash Player Settings panel i can't left click on anything. It is set to deny but I can't click allow, or close or any of the icons.
    Right click does work.
    I have followed countless instructions in other forums from other posts that have encountered the problem on Mac and older versions of AFP but as yet none of the solutions have proven succesul.
    I have tried all of the following but nothing has resolved the problem.
    1. Uninstall and reinstall Adobe Flash Player (although this is impossible using Google Chrome) and restart computer.
    2. Unistall flash and install older version. (made no difference on Google Chrome and on IE8 had no flash whatsoever).
    5. Uninstall older AFP and reinstall AFP11.
    4. Uninstall Google Chrome and restart computer.
    5. Uninstall QuickTime (I got this off http://www.techsupportforum.com/forums/f10/flash-player-not-working-properly-please-help-1 61552.html) and restart computer
    6. Last resort use keyboard shortcuts such as tab, enter and ctrl+arrows. This either didn't highlight the panel at all or if it did I still couln't select allow, or close the panel itself so was no help either.
    So now I'm back to square one.
    Now here's a really bizarre thing... I am using a shared laptop computer and if I use my colleagues profile where she hasn't updated her AFP to Adobe Flash Player 11 the settings panel is responding just fine. IT'S THE SAME PC!
    I know I am alone with this problem but someone out there has an answer. If you can help please let me know how to fix this problem where I can't left click in the Adobe Flash Player settings panel.and I will be eternily grateful.
    many thanks
    nik

    OK the amount I hate myself right now is more than a fat guy's self loathing for raiding the fridge at 2am for Pizza but less than an armed robber who's accidentally shot a pregnant woman in the stomach during a shootout. but not much less.
    So after I had miraculously got the Flash Player Setting Panel to work again, (after deleting QuickTime and leaving the window open for abut an hour it just started working again) I then got enticed into downloading the ustream producer software.
    While downloading it informed me that it would only work with QuickTime.
    Stupidly and Optimistically hoping it would remove the need to use flash player altogether I downloaded and installed both.
    I then discovered to my horror that Ustream producer is not a patch on Vidbalster and that it was not capable of delivering the same level of broadcast.
    I then opened the flash player settings panel on ustream and... the problem has returned!
    This means I am 99% sure that QuickTime IS the cause of the problem so I have uninstalled QT off the PC. I have also uninstalled Ustream Producer.
    The thing is though, now no matter how many times I restart, or uninstall and reinstall Adobe, or Google Chrome, I am once again UNABLE TO LEFT CLICK IN THE FLASH PLAYER SETTINGS PANEL. AAAARRRRRGGGGHHHH!!!!
    What did I do? I fixed it and  f***ing broke it again!
    Now it properly will not come back to life! the problem is not solved and i urgently need help.
    Why does Adobe Flash Player Settings Panel and Apple QuickTime hate each other so much that they've got to ruin my life?
    Help forum PLEASE!
    Regards,
    nik

  • Spry Tabbed Panels Help

    Greetings everyone:
    I had an existing Spry tabbed panel with three tabs. I then
    added a fourth tab and used the up arrow to move it to the number
    one slot. It displays properly as far as the tab goes, but when the
    page loads the original number one tab (now number two) is always
    open.
    How do I make the new number one tab the default for being
    open when the page loads?
    Thanks in advance for any help.
    Glenn

    Duh! (Smacks self in the forehead!)
    How about in the property inspector - Default Panel.
    Duh!
    From reading all the purists posts on the board (Murray,
    David and the rest of the gang) I immediately started looking for
    this in the code and couldn't find it, so I posted the question.
    I know, looking in the code is a good thing! :)
    Thanks.
    Glenn

  • Scrollbar MouseWheel Scroll Help

    I'm using this scrollbar in all my pages in my site but have a slight problem.
    http://theflashconnection.com/book/export/html/186
    One of the sections in my site triggers sounds and movieclips as it scrolls down (it's a separate swf)
    After loading this page and loading another page all my scrollbars in  all the site stay making the sounds from that page. How can I unload  this event? or fix this thanks for the help.
    I'm loading swfs this way.
    var seccion:String="home";
    var loader:Loader = new Loader();
    function loadSection():void {
    loader.load(new URLRequest (""+seccion+".swf"))
    info_mc.addChild(loader);
    loadSection();
    function removeSection():void {
    loader.unload();
    SWFAddress.addEventListener(SWFAddressEvent.CHANGE  , onChange);
    function onChange(e:SWFAddressEvent):void
    if(e.value != "/")
    SWFAddress.setTitle("Anthony Lolli - " + e.value.substring(1));
    else
    SWFAddress.setTitle("Anthony Lolli - Home");
    switch(e.value)
    case "/home":
    seccion = "home"
    resetSubMenus();
    removeSection();
    loadSection();
    break;
    case "/about":
    seccion = "about"
    resetSubMenus();
    removeSection();
    loadSection();
    break;
    etc.
    Thanks for help.

    Thanks this worked.
    Though I had to change publish setting to flash 10.

  • Scrollbar Enable/Disable Help Me!!!

    How to make visible or no a scrollbar
    I try
    set_property_block('',blockSCROLLBAR_???,Property_false);
    set_property_block('',SCROLLBAR,??????);
    It doesn't work???!!!!
    Please help me!!
    Excuse me for accent i'm french.

    i don't think that its possible.
    in the help it says "Set Form Builder "
    when you look under "scrollbar"
    perhabs you can create an item with the
    same heigth an width and set them visible
    true an false
    ~
    speedy
    null

  • Removing components from  a  J panel Help?

    I have a J Panel which has on it a stack of 10 components which are composed
    of either jComboboxes or textfields. Duridng program operation I need to clear the panel and then
    add the components again in different locations depending on user selection.
    Problem is I can't seem to get rid of the comboboxes. I am trying a removeAll and then
    reinitializing/rebuilding with all text fields but the combobox won't go away.
    I have used various combinations of
    Even if I just do the removeAll the underlying panel jPanel2 does not clear itself completly
    jPanel2.validate();
    jPanel2.invalidate();
    jPanel2.doLayout();
    Nothing seems to work yet
    Help??

    You can try remove () and then call repaint, unless you've done that...

  • Use scrollbars when panel too small for components in it

    Hi
    I've got a JPanel which just uses flow layout to contain some components. The panel resizes with the JFrame it is in, and wraps the components to new "rows" of components if the width of the JFrame gets too small. Fine.
    If the space available is not sufficient, the components go off the bottom of the JPanel.
    So I thought "put the JPanel inside a JScrollPane".
    Problem is that the JScrollPane does not try to wrap the components to a new row of components if the width of the JFrame is too small. Instead, it displays the horizontal scrollbar, and ignores the fact that there is more space available.
    Below is some code - run the main method to see what I mean.
    If I set the layout for the JScrollPane to something else than the default ViewportLayout (eg GridLayout), then the components wrap to new rows as I want, but the horizontal scrollbar displays then, and it should not. Moreover, the vertical scrollbar never displays at all, even when the JFrame is not tall enough to display even a single rows of components.
    Can anyone show me what I am supposed to do?
    Thanks
    Mark
    package com.evotec.CCDViewer.Real3.mypackage;
    import java.awt.*;
    import javax.swing.*;
    public class TestScrollPanes extends JFrame  {
      private JScrollPane jScrollPane1 = new JScrollPane();
      private BorderLayout borderLayout1 = new BorderLayout();
      private JPanel jPanel1 = new JPanel();
      private JButton jButton1 = new JButton();
      private JButton jButton2 = new JButton();
      private JButton jButton3 = new JButton();
      private JButton jButton4 = new JButton();
      private JButton jButton5 = new JButton();
      private GridLayout gridLayout1 = new GridLayout();
      public TestScrollPanes() {
        try {
          jbInit();
        } catch(Exception e) {
          e.printStackTrace();
        this.setSize(500,500);
        this.setDefaultCloseOperation(EXIT_ON_CLOSE);
        this.setVisible(true);
      public static void main(String[] args) {
        new TestScrollPanes();
      private void jbInit() throws Exception {
        this.getContentPane().setLayout(borderLayout1);
        this.setSize(new Dimension(354, 270));
        jScrollPane1.getViewport().setLayout(gridLayout1);
        jButton1.setText("jButton1");
        jButton2.setText("jButton2");
        jButton3.setText("jButton3");
        jButton4.setText("jButton4");
        jButton5.setText("jButton5");
        jPanel1.add(jButton1, null);
        jPanel1.add(jButton2, null);
        jPanel1.add(jButton3, null);
        jPanel1.add(jButton4, null);
        jPanel1.add(jButton5, null);
        jScrollPane1.getViewport().add(jPanel1, null);
        this.getContentPane().add(jScrollPane1, BorderLayout.CENTER);
    }

    Custom24, the problem you are running into is due to a conflict between the
    FlowLayout and the ScrollPane; FlowLayout only wraps components when
    it hits the width of the panel, but inside a ScrollPane, the panel can be as
    wide as it wants. So, you have to limit that somehow. Also, FlowLayout goes
    right after the width of the panel, not the preferred width, and not via an
    accessor; it uses it directly.
    So, this seems to work.
    import java.awt.*;
    import javax.swing.*;
    public class TestScrollableFlowPanel extends JFrame {
         public static void main( String[] args ) {
              Runnable doEDT = new Runnable() {
                   public void run() {
                        new TestScrollableFlowPanel();
              SwingUtilities.invokeLater( doEDT );
         public TestScrollableFlowPanel() {
              try {
                   jbInit();
              } catch ( Exception e ) {
                   e.printStackTrace();
              this.setSize( 300, 300 );
              this.setDefaultCloseOperation( EXIT_ON_CLOSE );
              this.setVisible( true );
         private void jbInit() throws Exception {
              ScrollableFlowPanel panel = new ScrollableFlowPanel();
              for ( int k = 0; k < 120; k++ )
                   panel.add( new JButton( "Button"  + k ) );
              JScrollPane scroll = new JScrollPane( panel );
              this.getContentPane().setLayout( new BorderLayout() );
              this.getContentPane().add( scroll, BorderLayout.CENTER );
         static public class ScrollableFlowPanel extends JPanel implements Scrollable {
              public void setBounds( int x, int y, int width, int height ) {
                   super.setBounds( x, y, getParent().getWidth(), height );
              public Dimension getPreferredSize() {
                   return new Dimension( getWidth(), getPreferredHeight() );
              public Dimension getPreferredScrollableViewportSize() {
                   return super.getPreferredSize();
              public int getScrollableUnitIncrement( Rectangle visibleRect, int orientation, int direction ) {
                   int hundredth = ( orientation ==  SwingConstants.VERTICAL
                             ? getParent().getHeight() : getParent().getWidth() ) / 100;
                   return ( hundredth == 0 ? 1 : hundredth );
              public int getScrollableBlockIncrement( Rectangle visibleRect, int orientation, int direction ) {
                   return orientation == SwingConstants.VERTICAL ? getParent().getHeight() : getParent().getWidth();
              public boolean getScrollableTracksViewportWidth() {
                   return true;
              public boolean getScrollableTracksViewportHeight() {
                   return false;
              private int getPreferredHeight() {
                   int rv = 0;
                   for ( int k = 0, count = getComponentCount(); k < count; k++ ) {
                        Component comp = getComponent( k );
                        Rectangle r = comp.getBounds();
                        int height = r.y + r.height;
                        if ( height > rv )
                             rv = height;
                   rv += ( (FlowLayout) getLayout() ).getVgap();
                   return rv;
    }: jay

  • 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);
    //==============================================================================

  • Toggling btwn panels  -help w setup

    I'm trying to avoid using the mouse as much as I do, and was wondering if anyone knows how to avoid that when I have to click in each of my three open panels to edit code. I know Shift/Tab covers toggling btwn docs. I looked at the cs5 keyboard shortcuts and not found a solution. For my setup I have two standard monitors, with the Design view open on the left monitor, Code view for CSS is dragged to half the monitor on the right, with the  source code/ F10 panel occupying the other half. So I click in each one every time I want to edit, and I have to click in the Design view to scroll down and see the bottom, and I have to save each time before viewing the source code update, which also would be nice to stop. Lots of RMT I'd like to avoid. Does anyone have a solution? Thank you.

    Hello Lindsey,
    I was finally able to commit some time to this project today and I did make some progress. I decided to move all of the task creation elements out of the while loop and I also added the wait and stop function after the write function. Once I made the changes I just explained, the DAQ board started outputting pulses on Port0 Line 0. I decided to check the other lines and I was disappointed to see that only one of the lines was outputting any data.
    I am including a screen shot of the latest version of the block diagram below:
    Here is the front Panel:
    This is a screen shot of the scope that I am using to monitor the output lines:
    CH1 - Yellow - line 0
    CH2 - Green - line 1
    CH3 - Blue - Line 2
    CH4 - Orange - Clock Pulse for timing function
    As you can see, there is no data on line 1 or line 2. Could you provide me any insight as to why this might be happeneing? 
    The issue I was having with the mismatch of data types is when I fed my 2D U8 array in to a N sample N channel write function with the U8 data type selected and the error code I was recieving was 200565. I was able to resolve it by changing the write function to a 32 bit data type but I am uncertain why it reads a 2D U8 array as a 32 bit data source. 
    Thank you in advance for any help you might be able to provide. 
    ~ Randy 

  • Icloud control panel help!

    i have windows 8 on my pc..i cant get icloud  control panel to run .
    any help would be greatly appreciated.

    opps ...sorry i miss spoke.
    i have windows xp on my pc...
    my question is. Can i get the icloud to work with the xp?
    If not??????

  • Spry Gallery and Sliding Panel help.

    Hi all,
    Sorry for my english, i'm french lol.
    I want combined the gallery with the sliding panel for
    display the thumbnails but I am blocked.
    Any help would be appreciated!
    Thanks

    Can you provide more information about your project?
    Are you loading the thumbs through Spry Data?
    Have you seen:
    http://labs.adobe.com/technologies/spry/samples/slidingpanels/SlidingPanelsSample2.html
    Thanks,
    Don

  • Logging Panel (help!)

    Hi everyone,
    I want to add a logging panel to my frame. I want to use it in order to diplay text messages displayed by the program rather than printing it to the console.
    I don't know how to direct the text to this panel. Would plz tell me how to do this? or give me a reference to read?
    Many Thanks,
    Somaya

    I can't really understand why you want to redirect System.out/System.err ("printing to the console") if you are using a frame. Why print to the console instead of using GUI components only?
    However odd it may seem, I thought it would be a fun experiment so I created a panel class you can use:
    import javax.swing.*;
    import java.awt.*;
    import java.io.OutputStream;
    import java.io.PrintStream;
    import java.io.IOException;
    * Panel class that can intercept and redirect System.out and/or System.err to internal scrollable JTextArea.
    public class OutErrInterceptingPanel extends JPanel
        * @param interceptErrStream decides whether or not to intercept and redirect System.err to text area
        * @param interceptOutStream decides whether or not to intercept and redirect System.out to text area
       public OutErrInterceptingPanel(boolean interceptErrStream, boolean interceptOutStream)
          JTextArea logArea = new JTextArea();
          logArea.setEditable(false);
          setLayout(new BorderLayout());
          add(new JScrollPane(logArea), BorderLayout.CENTER);
          //Use fake/intercepting OutStream to connect PrintStream(-s) to JTextArea...
          OutputStream wrapper = null;
          if (interceptErrStream)
             wrapper = new StreamWrapper(logArea);
             System.setErr(new PrintStream(wrapper));
          if (interceptOutStream)
             if (wrapper == null)
                wrapper = new StreamWrapper(logArea);
             System.setOut(new PrintStream(wrapper));
        * Acts as an OutputStream but it intercepts all write calls and adds data to a JTextArea instead...
       private class StreamWrapper extends OutputStream
          private JTextArea outputSource;
          public StreamWrapper(JTextArea aOutputSource)
             outputSource = aOutputSource;
          public void write(int b) throws IOException
             //Convert and append to JTextArea (Note that append method is thread safe)
             if (b < 0)
                outputSource.append("?"); //Replace invalid char with a question mark
             else
                char[] chars = Character.toChars(b);
                for (int i = 0; i < chars.length; i++)
                   outputSource.append(Character.toString(chars));
    public void write(byte[] b) throws IOException
    for (int i = 0; i < b.length; i++)
    write(b[i]);
    public void write(byte[] b, int off, int len) throws IOException
    for (int i = off; i < off + len; i++)
    write(b[i]);
    And of course I also created a GUI application for testing the panel:
    import javax.swing.*;
    import java.awt.*;
    public class TextAreaLogger extends JFrame
       public TextAreaLogger(JPanel logPanel)
          super("Sample Application on how to use OutErrInterceptingPanel");
          getContentPane().add(new JLabel("See OutErrInterceptingPanel in action below:"), BorderLayout.NORTH);
          getContentPane().add(logPanel, BorderLayout.CENTER);
       public static void main(String[] args)
          //Create GUI on the event dispatching thread
          try
             SwingUtilities.invokeAndWait(new Runnable()
                public void run()
                   //Create intercepting panel (intercept System.out only) and use it in GUI
                   JPanel logPanel = new OutErrInterceptingPanel(false, true);
                   TextAreaLogger frame = new TextAreaLogger(logPanel);
                   frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
                   frame.setSize(450, 400);
                   frame.setVisible(true);
          } catch (Exception e)
          //Print 25 lines to System.out 25 lines to System.err
          for (int i = 1; i <= 25; i++)
             System.out.println("This is a line "+ i +" written to System.out");
             System.err.println("This is a line "+ i +" written to System.err");
    }My implementation may not be the best way of redirecting System.out and System.err to a text area, but it sure was fun to do! =)
    Note. If I completely misinterpreted what you wanted help with - if all you really wanted was to know a litle bit about JTextArea - you may find this link useful (and you should probably just ignore the code above):
    http://java.sun.com/docs/books/tutorial/uiswing/components/text.html

  • Dreamweaver CS6 Insert Panel Help

    I am trying the 30 day Dreamweaver CS6 Creative Cloud and would like to know how to get the Text Bar in the Insert Panel. I currently have the following in my insert panel.
    Common
    Structure
    Media
    Form
    jQuery Mobile
    jQuery UI
    Templates
    Favorites
    I am new to Dreamweaver so any help is greatly appreciated.
    Thanks
    Mark

    If you have that set-up in the Insert panel, you're using Dreamweaver CC (version 13), not Dreamweaver CS6 (version 12).
    The Text category was removed from the Insert panel in Dreamweaver CC because it duplicated features that were available elsewhere. If you're looking for special characters, they're now at the bottom of the Common category in the Insert panel.

Maybe you are looking for