java Programming Glossary: canvas
Dynamic Graphics Object Painting In Java http://stackoverflow.com/questions/10628492/dynamic-graphics-object-painting-in-java 20 350 380 public static void main String args MyCanvas canvas new MyCanvas JFrame frame new JFrame int vertexes 0 Change this.. Change this next part later to be dynamic. vertexes 10 int canvasSize vertexes vertexes frame.setSize canvasSize canvasSize frame.setDefaultCloseOperation.. vertexes 10 int canvasSize vertexes vertexes frame.setSize canvasSize canvasSize frame.setDefaultCloseOperation JFrame.EXIT_ON_CLOSE..
Resizing issue with canvas within jscrollpane within jsplitpane http://stackoverflow.com/questions/11942961/resizing-issue-with-canvas-within-jscrollpane-within-jsplitpane issue with canvas within jscrollpane within jsplitpane I'm creating an application.. jScrollPane1 new javax.swing.JScrollPane canvas1 new java.awt.Canvas jTextField1 new javax.swing.JTextField.. jScrollPane1.setViewportView canvas1 jSplitPane1.setTopComponent jScrollPane1 jTextField1.setText..
How to make line animation smoother? http://stackoverflow.com/questions/13540534/how-to-make-line-animation-smoother is choppy pixel by pixel. Each of my rectangles on the canvas has this method to paint itself. It is moved every 20ms and.. to paint itself. It is moved every 20ms and the whole canvas is repainted using Timer and TimerListener. import javax.swing... public void copy public void update AnimationCanvas canvas float progress public void paint Graphics2D g2d public static..
Threads with Key Bindings http://stackoverflow.com/questions/13999506/threads-with-key-bindings e System.out.println You Interrupted the game canvas.repaint Here's the paintComponent method of the canvas object.. canvas.repaint Here's the paintComponent method of the canvas object public void paintComponent Graphics g super.paintComponent..
Capturing image from webcam in java? http://stackoverflow.com/questions/276292/capturing-image-from-webcam-in-java 1000 you may use interval IplImage image CanvasFrame canvas new CanvasFrame Web Cam public GrabberShow canvas.setDefaultCloseOperation.. canvas new CanvasFrame Web Cam public GrabberShow canvas.setDefaultCloseOperation javax.swing.JFrame.EXIT_ON_CLOSE @Override.. cvSaveImage i capture.jpg img show image on window canvas.showImage img Thread.sleep INTERVAL catch Exception e There..
Android How to draw a smooth line following your finger http://stackoverflow.com/questions/8287949/android-how-to-draw-a-smooth-line-following-your-finger line. Here's the code to do so public void onDraw Canvas canvas Path path new Path boolean first true for Point point points.. point.x point.y else path.lineTo point.x point.y canvas.drawPath path paint make sure you change your paint from fill.. using the quadTo method public void onDraw Canvas canvas Path path new Path boolean first true for int i 0 i points.size..
Dynamic Graphics Object Painting In Java http://stackoverflow.com/questions/10628492/dynamic-graphics-object-painting-in-java so far import java.awt. import javax.swing. public class MyCanvas extends Canvas public MyCanvas public void paint Graphics graphics.. import javax.swing. public class MyCanvas extends Canvas public MyCanvas public void paint Graphics graphics Keep this.. javax.swing. public class MyCanvas extends Canvas public MyCanvas public void paint Graphics graphics Keep this until I figured..
Resizing issue with canvas within jscrollpane within jsplitpane http://stackoverflow.com/questions/11942961/resizing-issue-with-canvas-within-jscrollpane-within-jsplitpane to have a JSplitPane the top component of which will be a Canvas within a JScrollPane and the bottom component will be a JTextArea.. the divider upwards The divider seems to go beneath the Canvas and maybe beneath the JScrollPane too . I have tried various.. the preferred minimum maximum sizes of the JScrollPane and Canvas but nothing seems to work. This is the part of the code that..
How should I give images rounded corners in Android? http://stackoverflow.com/questions/1705239/how-should-i-give-images-rounded-corners-in-android this question Why not use clipPath protected void onDraw Canvas canvas Path clipPath new Path float radius 10.0f float padding..
Android - drawing path as overlay on MapView http://stackoverflow.com/questions/3036139/android-drawing-path-as-overlay-on-mapview have overriden its draw method @Override public void draw Canvas canvas MapView mv boolean shadow Projection projection mv.getProjection..
Serializing and De-Serializing android.graphics.Bitmap in Java http://stackoverflow.com/questions/5871482/serializing-and-de-serializing-android-graphics-bitmap-in-java private int height private Bitmap sourceImage private Canvas sourceCanvas private Bitmap currentImage private Canvas currentCanvas.. int height private Bitmap sourceImage private Canvas sourceCanvas private Bitmap currentImage private Canvas currentCanvas private.. Canvas sourceCanvas private Bitmap currentImage private Canvas currentCanvas private Paint currentPaint private void writeObject..
How do I draw an arrowhead (in Android)? http://stackoverflow.com/questions/6713757/how-do-i-draw-an-arrowhead-in-android I'm fairly new to Android and have been toying around with Canvas. I'm attempting to draw an arrow but I'm only having luck with.. context mContext context @Override protected void onDraw Canvas canvas Paint Background Paint background new Paint background.setColor..
Android Bitmap/Canvas offset after scale http://stackoverflow.com/questions/6835224/android-bitmap-canvas-offset-after-scale Bitmap Canvas offset after scale If I have a canvas on which I draw a Bitmap..
Recycle ImageView's Bitmap http://stackoverflow.com/questions/7009086/recycle-imageviews-bitmap Bitmap Bitmap.createBitmap 3000 3000 2000 conf Canvas canvas new Canvas bm.get canvas.drawBitmap firstBitmap 0 0 null.. Bitmap.createBitmap 3000 3000 2000 conf Canvas canvas new Canvas bm.get canvas.drawBitmap firstBitmap 0 0 null canvas.drawBitmap..
Swing method akin to HTML5's canvas.putImageData(arrayOfPixels, 0,0) http://stackoverflow.com/questions/7297950/swing-method-akin-to-html5s-canvas-putimagedataarrayofpixels-0-0 as detailed here https developer.mozilla.org En HTML Canvas Pixel_manipulation_with_canvas Is there a convenience method..
How can I use a custom bitmap for the “you are here” point in a MyLocationOverlay? http://stackoverflow.com/questions/753793/how-can-i-use-a-custom-bitmap-for-the-you-are-here-point-in-a-mylocationoverla android.graphics.BitmapFactory import android.graphics.Canvas import android.graphics.Matrix import android.graphics.Point.. mContext context @Override protected void drawMyLocation Canvas canvas MapView mapView Location lastFix GeoPoint myLocation..
Android How to draw a smooth line following your finger http://stackoverflow.com/questions/8287949/android-how-to-draw-a-smooth-line-following-your-finger straight line. Here's the code to do so public void onDraw Canvas canvas Path path new Path boolean first true for Point point.. iterpolation using the quadTo method public void onDraw Canvas canvas Path path new Path boolean first true for int i 0 i points.size.. calculate the cubic splines as follows public void onDraw Canvas canvas Path path new Path if points.size 1 for int i points.size..
Drawing rectangle on a JPanel http://stackoverflow.com/questions/9258890/drawing-rectangle-on-a-jpanel import javax.swing. import java. import java.awt.Canvas import javax.swing.event.ChangeEvent import javax.swing.event.ChangeListener.. import javax.swing.event.ChangeListener class DisplayCanvas extends Canvas static boolean clip false static boolean clipfurther.. class DisplayCanvas extends Canvas static boolean clip false static boolean clipfurther false static..
|