Search Results

Search found 829 results on 34 pages for 'paint'.

Page 11/34 | < Previous Page | 7 8 9 10 11 12 13 14 15 16 17 18  | Next Page >

  • How do you implement position-sensitive zooming inside a JScrollPane?

    - by tucuxi
    I am trying to implement position-sensitive zooming inside a JScrollPane. The JScrollPane contains a component with a customized 'paint' that will draw itself inside whatever space it is allocated - so zooming is as easy as using a MouseWheelListener that resizes the inner component as required. But I also want zooming into (or out of) a point to keep that point as central as possible within the resulting zoomed-in (or -out) view (this is what I refer to as 'position-sensitive' zooming), similar to how zooming works in google maps. I am sure this has been done many times before - does anybody know the "right" way to do it under Java Swing?. Would it be better to play with Graphic2D's transformations instead of using JScrollPanes? Sample code follows: package test; import java.awt.*; import java.awt.event.*; import java.awt.geom.*; import javax.swing.*; public class FPanel extends javax.swing.JPanel { private Dimension preferredSize = new Dimension(400, 400); private Rectangle2D[] rects = new Rectangle2D[50]; public static void main(String[] args) { JFrame jf = new JFrame("test"); jf.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); jf.setSize(400, 400); jf.add(new JScrollPane(new FPanel())); jf.setVisible(true); } public FPanel() { // generate rectangles with pseudo-random coords for (int i=0; i<rects.length; i++) { rects[i] = new Rectangle2D.Double( Math.random()*.8, Math.random()*.8, Math.random()*.2, Math.random()*.2); } // mouse listener to detect scrollwheel events addMouseWheelListener(new MouseWheelListener() { public void mouseWheelMoved(MouseWheelEvent e) { updatePreferredSize(e.getWheelRotation(), e.getPoint()); } }); } private void updatePreferredSize(int n, Point p) { double d = (double) n * 1.08; d = (n > 0) ? 1 / d : -d; int w = (int) (getWidth() * d); int h = (int) (getHeight() * d); preferredSize.setSize(w, h); getParent().doLayout(); // Question: how do I keep 'p' centered in the resulting view? } public Dimension getPreferredSize() { return preferredSize; } private Rectangle2D r = new Rectangle2D.Float(); public void paint(Graphics g) { super.paint(g); g.setColor(Color.red); int w = getWidth(); int h = getHeight(); for (Rectangle2D rect : rects) { r.setRect(rect.getX() * w, rect.getY() * h, rect.getWidth() * w, rect.getHeight() * h); ((Graphics2D)g).draw(r); } } }

    Read the article

  • Winforms panel event after scroll

    - by Charlie boy
    Hello I have a panel in wich I do a bounch af rater complex drawing in the paint event. Since the drawing-code is kind of heavy, it gets rather twitchy when I scroll the panel, since the paint event is raised in such short intervals. My question is really this; Can i capture evnts such as "on scroll start" and "on scroll end" on a winforms control? If so, I could then just pause the drawing-code until the scroll is complete. Thanks in advance!

    Read the article

  • What is the equivalent to Java's canvas object in C#?

    - by Winston
    I'm working on creating a basic application that will let a user draw (using a series of points) and I plan to do something with these points. If this were Java, I think I would probably use a canvas object and some Java2D calls to draw what I want. All the tutorials I've read on C#/Drawing involve writing your own paint method and adding it to the paint event for the form. However, I'm interested in having some traditional Form controls as well and I don't want to be drawing over them. So, is there a "Canvas" object where I can constrain what I'm drawing on? Also, is WinForms a poor choice given this use case? Would WPF have more features that would help enable me to do what I want? Or Silverlight?

    Read the article

  • Pixel plot method errors out without error message.

    - by sonny5
    // The following method blows up (big red x on screen) without generating error info. Any // ideas why? // MyPlot.PlotPixel(x, y, Color.BlueViolet, Grf); // runs if commented out // My goal is to draw a pixel on a form. Is there a way to increase the pixel size also? using System; using System.Drawing; using System.Drawing.Drawing2D; using System.Collections; using System.ComponentModel; using System.Windows.Forms; using System.Data; public class Plot : System.Windows.Forms.Form { private Size _ClientArea; //keeps the pixels info private double _Xspan; private double _Yspan; public Plot() { InitializeComponent(); } public Size ClientArea { set { _ClientArea = value; } } private void InitializeComponent() { this.AutoScaleBaseSize = new System.Drawing.Size(5, 13); this.ClientSize = new System.Drawing.Size(400, 300); this.Text="World Plot (world_plot.cs)"; this.Resize += new System.EventHandler(this.Form1_Resize); this.Paint += new System.Windows.Forms.PaintEventHandler(this.doLine); this.Paint += new System.Windows.Forms.PaintEventHandler(this.TransformPoints); // new this.Paint += new System.Windows.Forms.PaintEventHandler(this.DrawRectangleFloat); this.Paint += new System.Windows.Forms.PaintEventHandler(this.DrawWindow_Paint); } private void DrawWindow_Paint(object sender, PaintEventArgs e) { Graphics Grf = e.Graphics; pixPlot(Grf); } static void Main() { Application.Run(new Plot()); } private void doLine(object sender, System.Windows.Forms.PaintEventArgs e) { // no transforms done yet!!! Graphics g = e.Graphics; g.FillRectangle(Brushes.White, this.ClientRectangle); Pen p = new Pen(Color.Black); g.DrawLine(p, 0, 0, 100, 100); // draw DOWN in y, which is positive since no matrix called p.Dispose(); } public void PlotPixel(double X, double Y, Color C, Graphics G) { Bitmap bm = new Bitmap(1, 1); bm.SetPixel(0, 0, C); G.DrawImageUnscaled(bm, TX(X), TY(Y)); } private int TX(double X) //transform real coordinates to pixels for the X-axis { double w; w = _ClientArea.Width / _Xspan * X + _ClientArea.Width / 2; return Convert.ToInt32(w); } private int TY(double Y) //transform real coordinates to pixels for the Y-axis { double w; w = _ClientArea.Height / _Yspan * Y + _ClientArea.Height / 2; return Convert.ToInt32(w); } private void pixPlot(Graphics Grf) { Plot MyPlot = new Plot(); double x = 12.0; double y = 10.0; MyPlot.ClientArea = this.ClientSize; Console.WriteLine("x = {0}", x); Console.WriteLine("y = {0}", y); //MyPlot.PlotPixel(x, y, Color.BlueViolet, Grf); // blows up } private void DrawRectangleFloat(object sender, PaintEventArgs e) { // Create pen. Pen penBlu = new Pen(Color.Blue, 2); // Create location and size of rectangle. float x = 0.0F; float y = 0.0F; float width = 200.0F; float height = 200.0F; // translate DOWN by 200 pixels // Draw rectangle to screen. e.Graphics.DrawRectangle(penBlu, x, y, width, height); } private void TransformPoints(object sender, System.Windows.Forms.PaintEventArgs e) { // after transforms Graphics g = this.CreateGraphics(); Pen penGrn = new Pen(Color.Green, 3); Matrix myMatrix2 = new Matrix(1, 0, 0, -1, 0, 0); // flip Y axis with -1 g.Transform = myMatrix2; g.TranslateTransform(0, 200, MatrixOrder.Append); // translate DOWN the same distance as the rectangle... // ...so this will put it at lower left corner g.DrawLine(penGrn, 0, 0, 100, 90); // notice that y 90 is going UP } private void Form1_Resize(object sender, System.EventArgs e) { Invalidate(); } }

    Read the article

  • c# - clear surface when resizing

    - by dhh
    Hello, I'm trying to build my own custom control for a windows forms application in C#.Net. Currently I paint some rectangles and other graphic elements using the paint event. When I now resize the app form to fit the desktop size, all elements are repainted (which is exactly the behaviour I need) but the old one's are shown in the background. Here's what I'm doing by now: Pen penDefaultBorder = new Pen(Color.Wheat, 1); int margin = 5; private void CustomControl_Paint(object sender, PaintEventArgs e) { CustomControl calendar = (CustomControl)sender; Graphics graphics = e.Graphics; graphics.Clear(Color.WhiteSmoke); graphics.DrawRectangle(penDefaultBorder, margin, margin, calendar.Width - margin * 2, calendar.Height - margin * 2); //... } Neither the graphics.Clear, nor adding a graphics.FillRectangle(...) will hide the old rectangle from the surface. Ideas? Thank you all.

    Read the article

  • Simple syntax error still eluding me.

    - by melee
    Here is the header for a class I started: #ifndef CANVAS_ #define CANVAS_ #include <iostream> #include <iomanip> #include <string> #include <stack> class Canvas { public: Canvas(); void Paint(int R, int C, char Color); const int Nrow; const int Ncol; string Title; int image[][100]; stack<int> path; struct PixelCoordinates { unsigned int r; unsigned int c; } position; Canvas operator<< (const Canvas& One ); Canvas operator>>( Canvas& One ); }; /*----------------------------------------------------------------------------- Name: operator<< Purpose: Put a Canvas into an output stream -----------------------------------------------------------------------------*/ ostream& operator<<( ostream& Out, const Canvas& One ) { Out << One.Title << endl; Out << "Rows: " << One.Nrow << " Columns: " << One.Ncol << endl; int i,j; for( i=0; i<One.Nrow; i++) { cout<<"\n\n\n"; cout<< " COLUMN\n"; cout<< " 1 2 3"; for(i=0;i<One.Nrow;i++) { cout<<"\nROW "<<i+1; for(j=0;j<One.Ncol;j++) cout<< One.image[i][j]; } } return Out; } /*----------------------------------------------------------------------------- Name: operator>> Purpose: Get a Canvas from an input stream -----------------------------------------------------------------------------*/ istream& operator>>( istream& In, Canvas& One ) { // string Line; // int Place = 0; // { // In >> Line; // if (In.good()) // { // One.image[Place][0] = Line; // Place++; // } // return In; #endif Here is my implementation file for class Canvas: using namespace std; #include <iostream> #include <iomanip> #include <string> #include <stack> #include "proj05.canvas.h" //----------------Constructor----------------// Canvas::Canvas() { Title = ""; Nrow = 0; Ncol = 0; image[][100] = {}; position.r = 0; position.c = 0; } //-------------------Paint------------------// void Canvas::Paint(int R, int C, char Color) { cout << "Paint to be implemented" << endl; } And the errors I'm getting are these: proj05.canvas.cpp: In function 'std::istream& operator>>(std::istream&, Canvas&)': proj05.canvas.cpp:11: error: expected `;' before '{' token proj05.canvas.cpp:24: error: expected `}' at end of input From my limited experience, they look like simple syntax errors but for the life of me, I cannot see what I am missing. I know putting a ; at the end of Canvas::Canvas() is wrong but that seems to be what it expects. Could someone please clarify for me? (Also, I know much of the code for the << and operator definitions look terrible, but unless that is the specific reason for the error please do not address it. This is a draft :) )

    Read the article

  • QT: QPainter + GDI in the same widget?

    - by shoosh
    I'm trying to use the method described here to use a QPainter and GDI calls on the same widget. Unfortunately this tutorial seem to have been written on an earlier version of QT and now it does not work. I set the WA_PaintOnScreen flag and reimplement paintEngine() to return NULL. Then on the paintEvent() I create a QPainter, use it and then use some GDI calls to paint a bitmap. The GDI calls work fine but the QPainter does nothing. I get the following error on the console: QPainter::begin: Paint device returned engine == 0, type: 1 Is this simply not supported anymore? how can I do it? I've also tried creating an additional widget on top of the GDI-painting widget but that didn't go well as well since the top widget appears black and blocks the GDI widget.

    Read the article

  • Drawing random circles

    - by ViktorC
    I am trying to draw a cupola circles at random positions in an Android application. I draw them on a bitmap and then draw that bitmap on the canvas. This is the function where a draw the circles: private void drawRandomCircles(int numOfCircles) { Canvas c = new Canvas(b); Paint cPaint = new Paint; cPaitn.setColor(Color.RED); for(int i = 0; i < numOfCircles; i++) { int x = Math.Random % 100; int y = Math.Random % 100; c.drawCircle(x, y, 20, cPaint) } } The Bitmap b is global. And after calling this function I just draw the bitmap in the onDraw method. Now the problem is that I only get one circle drawn on the screen, no matter the size of numOfCircles. Any clue what is happening here?

    Read the article

  • How to do animation using swing and clojure ?

    - by Humberto Pinheiro
    I'm trying to animate a chess piece in a board. First I created a java.util.Timer object that "scheduleAtFixedRate" a TimerTask implemented as a proxy function. So I kept a record of the piece to move (piece-moving-record) and when it's apropriate (when the user move the piece using the mouse) the TimerTask proxy function should be test if the record is not nil and execute the piece-moving function. The piece-moving function just updates the x and y coordinates of the piece, according to a vector pre-calculated. I put a add-watch on the piece-moving-record so when it changes it should repaint the board (canvas). The paint method tests if this piece-moving-record is not nil to paint it. The problem is that the animation doesn't appear. The piece just jump to the destiny, without the movement between. There is some problem with the animation scheme ou there is a better way to do it?

    Read the article

  • How to set different colors to the bars in stacked bar chart in ireport ?

    - by Purushotham
    Hi, I need to set a unique color to each bar in the stacked bar chart. Whatever the color I see in one bar it shouldn't be repeated in any other bar or any other stack. For example: I have 5 bars in the report. Each bar has 3 different stacks. I want to apply a red related colors to the first bar and its stacks. Second bar should have blue related colors. etc.. It is showed in the attached image. The image shows a very basic requirement what we want. Just created using a normal ms paint. Stacked Bar MS Paint Image

    Read the article

  • What Windows message is fired for mouse-up with modifier keys?

    - by Greg
    My WndProc isn't seeing mouse-up notifications when I click with a modifier key (shift or control) pressed. I see them without the modifier key, and I see mouse-down notifications with the modifier keys. I'm using the Windows Forms NativeWindow wrapper to get Windows messages from the WndProc() method. I've tried tracking the notifications I do get, and I the only clue I see is WM_CAPTURECHANGED. I've tried calling SetCapture when I receive the WM_LBUTTONDOWN message, but it doesn't help. Without modifier (skipping paint, timer and NCHITTEST messages): WM_LBUTTONDOWN WM_SETCURSOR WM_MOUSEMOVE WM_SETCURSOR WM_LBUTTONUP With modifier (skipping paint, timer and NCHITTEST messages): WM_KEYDOWN WM_PARENTNOTIFY WM_MOUSEACTIVATE WM_MOUSEACTIVATE WM_SETCURSOR WM_LBUTTONDOWN WM_SETCURSOR (repeats) WM_KEYDOWN (repeats) WM_KEYUP If I hold the mouse button down for a long time, I can usually get a WM_LBUTTONUP notification, but it should be possible to make it more responsive.. What am I missing? Thanks.

    Read the article

  • Override onDraw to change how the drawing occurs (Android)

    - by Casebash
    I want to change how my UI elements display, so I am overriding onDraw. The following code allows me to change a View to be drawn using PorterDuff.Mode.DARKEN. Unfortunately, this method involves creating a bitmap the size of the entire screen, then drawing to it then drawing this large bitmap the main screen again, for each UI element. This isn't at all efficient. Is it possible to achieve this in a more effecient way? @Override protected void onDraw(Canvas canvas) { //TODO: Reduce the burden from multiple drawing Bitmap bitmap=Bitmap.createBitmap(canvas.getWidth(), canvas.getHeight(), Config.ARGB_8888); Log.e("tmp",canvas.getClipBounds().toString()); Canvas offscreen=new Canvas(bitmap); super.onDraw(offscreen); //Then draw onscreen Paint p=new Paint(); p.setXfermode(new PorterDuffXfermode(PorterDuff.Mode.DARKEN)); canvas.drawBitmap(bitmap, 0, 0, p); }

    Read the article

  • Using custom fonts on Android

    - by karse23
    Hi there, I'm trying to load a custom font as follows: private Paint customFont18; customFont18 = new Paint(); customFont18.setTextSize(18); Typeface fontFace = Typeface.createFromAsset(getAssets(), "FONT.TTF"); customFont18.setTypeface(fontFace); The getAssets fails, thows this: -The method getAssets() is undefined for the type MyClass -assetManager cannot be resolved to a variable What is my problem? I've seen several examples like this but none works in my case. Thanks in advance.

    Read the article

  • java graphics display help

    - by java
    I know that i am not calling the graphics paint command in the mainframe in order to display it. but i'm not sure how. thanks in advance import java.awt.*; import javax.swing.*; public class MainFrame extends JFrame { private static Panel panel = new Panel(); public MainFrame() { panel.setBackground(Color.white); Container c = getContentPane(); c.add(panel); } public void paint(Graphics g) { g.drawString("abc", 20, 20); } public static void main(String[] args) { MainFrame frame = new MainFrame(); frame.setVisible(true); frame.setSize(600, 400); frame.setResizable(false); frame.setLocationRelativeTo(null); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); } }

    Read the article

  • MonthCalendar control selection range with EnableVisualStyles?

    - by warren_s
    I'm using the MonthCalendar control and want to programmatically select a date range. When I do so the control doesn't paint properly if Application.EnableVisualStyles() has been called. This is a known issue according to MSDN. Using the MonthCalendar with visual styles enabled will cause a selection range for the MonthCalendar control to not paint correctly (from: http://msdn.microsoft.com/en-us/library/system.windows.forms.monthcalendar.aspx) Is there really no fix for this other than not calling EnableVisualStyles? This seems to make that particular control entirely useless for a range of applications and a rather glaring oversight from my perspective.

    Read the article

  • Blackberry Developement

    - by varun
    Hi, I am new to Blackberry Development.This is my first Question for you people. I am creating a search box for my project. But it looks like blackberry doesn't have an internal api for creating single line Edit field. I have created a Custom Field by extending BasciEditField overriding methods like layout, paint. In paint i am drawing a rectangle with getpreferred width and height. But the cursor is coming at default position (top-left) in Edit Field. Can any body tell me how i can draw it where my text is(i.e in middle of Edit Field by calling drwaText()). Thanks,

    Read the article

  • .net c# datagridview populating with non database data/setup

    - by flavour404
    Hi, I have never used the datagridview in any other scenario other than one where it is populating by a database so suddenly my mind goes blank... I have 10 tubes, each with 8 vertical positions within it, so I have a 10 by 8 grid basically. Each has of those slots has (or not) an image in a folder. How do I get a datagridview to reflect this information, draw a grid, check the folder and if the image exists paint it white, and if not paint it red? Sorry it if sounds a little odd, thanks, R.

    Read the article

  • How to get ImageButton size within Android GridView?

    - by wufoo
    I'm subclassing ImageButton in order to draw lines on it and trying to figure out where the actual button coordinates are within my gridview. I am using onGlobalLayout to setup Top, Bottom, Right and Left, but these seem to be for the actual "square" within the grid, and not the actual button (see image). The purple lines are drawn in myImageButton.onDraw() using coords gathered from myImageButton.onGlobalLayout(). I thought these would be for the button, but they seem to be from something else. Not sure what. I'd like the purple lines to match the outline of the button so the lines I draw appear on the button and not just floating out in the LinearLayout somewhere. The light blue is the background color of the vertical LinearLayout holding the Textview (for the number) and myImageButton. Any way to get the actual button size? XML Layout: <FrameLayout xmlns:android="http://schemas.android.com/apk/res/android" android:id="@+id/lay_cellframe" android:layout_width="fill_parent" android:layout_height="fill_parent" > <LinearLayout android:layout_width="fill_parent" android:layout_height="fill_parent" android:gravity="fill_vertical|fill_horizontal" android:orientation="vertical" > <TextView android:id="@+id/tv_cell" android:layout_width="fill_parent" android:layout_height="wrap_content" android:layout_margin="2dp" android:gravity="center" android:text="TextView" android:textSize="10sp" /> <com.example.icaltest2.myImageButton android:id="@+id/imageButton1" android:layout_width="fill_parent" android:layout_height="fill_parent" android:layout_gravity="center" android:layout_margin="0dp" android:adjustViewBounds="false" android:background="@android:drawable/btn_default" android:scaleType="fitXY" android:src="@android:color/transparent" /> </LinearLayout> </FrameLayout> myImageButton.java public myImageButton (Context context, AttributeSet attrs) { super (context, attrs); mBounds = new Rect(); ViewTreeObserver vto = this.getViewTreeObserver (); vto.addOnGlobalLayoutListener (ogl); Log.d (TAG, "myImageButton"); } ... OnGlobalLayoutListener ogl = new OnGlobalLayoutListener() { @Override public void onGlobalLayout () { Rect b = getDrawable ().getBounds (); mBtnTop = b.centerY () - (b.height () / 2); mBtnBot = b.centerY () + (b.height () / 2); mBtnLeft = b.centerX () - (b.width () / 2); mBtnRight = b.centerX () + (b.width () / 2); } }; ... @Override protected void onDraw (Canvas canvas) { super.onDraw (canvas); Paint p = new Paint (); p.setStyle (Paint.Style.STROKE); p.setStrokeWidth (1); p.setColor (Color.MAGENTA); canvas.drawCircle (mBtnLeft, mBtnTop, 2, p); canvas.drawCircle (mBtnLeft, mBtnBot, 2, p); canvas.drawCircle (mBtnRight, mBtnTop, 2, p); canvas.drawCircle (mBtnRight, mBtnBot, 2, p); canvas.drawRect (mBtnLeft, mBtnTop, mBtnRight, mBtnBot, p); }

    Read the article

  • Get a property value with only the object and the name of the property (but not the type)

    - by Vaccano
    Suppose I have a method that passes in the name of a property (as a string) and the object that the property is on (as object). How could I get the value of the property? Here is some code to make it a bit more concrete: protected override void Paint(Graphics g, Rectangle bounds, CurrencyManager source, int rowNum, Brush backBrush, Brush foreBrush, bool alignToRight) { // The next line is made up code var currentValue = source.Current.CoolMethodToTakePropertyNameAndReturnValue(MappingName); // Paint out the retrieved value g.DrawString(currentValue.ToString() , _gridFont, new SolidBrush(Color.Black), bounds.Left + 1, bounds.Top); } MappingName is the name of the property I want to get the value for. What I need is CoolMethodToTakePropertyNameAndReturnValue. Any ideas? I am running on the Compact Framework. I would also prefer to avoid reflection (but if that is my only recourse then so be it). Thanks for any help.

    Read the article

  • Create Custom Sized Thumbnail Images with Simple Image Resizer [Cross-Platform]

    - by Asian Angel
    Are you looking for an easy way to create custom sized thumbnail images for use in blog posts, photo albums, and more? Whether is it a single image or a CD full, Simple Image Resizer is the right app to get the job done for you. To add the new PPA for Simple Image Resizer open the Ubuntu Software Center, go to the Edit Menu, and select Software Sources. Access the Other Software Tab in the Software Sources Window and add the first of the PPAs shown below (outlined in red). The second PPA will be automatically added to your system. Once you have the new PPAs set up, go back to the Ubuntu Software Center and click on the PPA listing for Rafael Sachetto on the left (highlighted with red in the image). The listing for Simple Image Resizer will be right at the top…click Install to add the program to your system. After the installation is complete you can find Simple Image Resizer listed as Sir in the Graphics sub-menu. When you open Simple Image Resizer you will need to browse for the directory containing the images you want to work with, select a destination folder, choose a target format and prefix, enter the desired pixel size for converted images, and set the quality level. Convert your image(s) when ready… Note: You will need to determine the image size that best suits your needs before-hand. For our example we chose to convert a single image. A quick check shows our new “thumbnailed” image looking very nice. Simple Image Resizer can convert “into and from” the following image formats: .jpeg, .png, .bmp, .gif, .xpm, .pgm, .pbm, and .ppm Command Line Installation Note: For older Ubuntu systems (9.04 and previous) see the link provided below. sudo add-apt-repository ppa:rsachetto/ppa sudo apt-get update && sudo apt-get install sir Links Note: Simple Image Resizer is available for Ubuntu, Slackware Linux, and Windows. Simple Image Resizer PPA at Launchpad Simple Image Resizer Homepage Command Line Installation for Older Ubuntu Systems Bonus The anime wallpaper shown in the screenshots above can be found here: The end where it begins [DesktopNexus] Latest Features How-To Geek ETC Macs Don’t Make You Creative! So Why Do Artists Really Love Apple? MacX DVD Ripper Pro is Free for How-To Geek Readers (Time Limited!) HTG Explains: What’s a Solid State Drive and What Do I Need to Know? How to Get Amazing Color from Photos in Photoshop, GIMP, and Paint.NET Learn To Adjust Contrast Like a Pro in Photoshop, GIMP, and Paint.NET Have You Ever Wondered How Your Operating System Got Its Name? Create Shortcuts for Your Favorite or Most Used Folders in Ubuntu Create Custom Sized Thumbnail Images with Simple Image Resizer [Cross-Platform] Etch a Circuit Board using a Simple Homemade Mixture Sync Blocker Stops iTunes from Automatically Syncing The Journey to the Mystical Forest [Wallpaper] Trace Your Browser’s Roots on the Browser Family Tree [Infographic]

    Read the article

  • Using JDialog with Tabbed Pane to draw different pictures [migrated]

    - by Bryam Ulloa
    I am using NetBeans, and I have a class that extends to JDialog, inside that Dialog box I have created a Tabbed Pane. The Tabbed Pane contains 6 different tabs, with 6 different panels of course. What I want to do is when I click on the different tabs, a diagram is supposed to be drawn with the paint method. My question is how can I draw on the different panels with just one paint method in another class being called from the Dialog class? Here is my code for the Dialog class: package GUI; public class NewJDialog extends javax.swing.JDialog{ /** * Creates new form NewJDialog */ public NewJDialog(java.awt.Frame parent, boolean modal) { super(parent, modal); initComponents(); } /** * This method is called from within the constructor 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() { jTabbedPane1 = new javax.swing.JTabbedPane(); jPanel1 = new javax.swing.JPanel(); jPanel2 = new javax.swing.JPanel(); jPanel3 = new javax.swing.JPanel(); jPanel4 = new javax.swing.JPanel(); jPanel5 = new javax.swing.JPanel(); jPanel6 = new javax.swing.JPanel(); jPanel7 = new javax.swing.JPanel(); jLabel1 = new javax.swing.JLabel(); jLabel2 = new javax.swing.JLabel(); setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE); javax.swing.GroupLayout jPanel1Layout = new javax.swing.GroupLayout(jPanel1); jPanel1.setLayout(jPanel1Layout); jPanel1Layout.setHorizontalGroup( jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGap(0, 466, Short.MAX_VALUE) ); jPanel1Layout.setVerticalGroup( jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGap(0, 242, Short.MAX_VALUE) ); jTabbedPane1.addTab("FCFS", jPanel1); javax.swing.GroupLayout jPanel2Layout = new javax.swing.GroupLayout(jPanel2); jPanel2.setLayout(jPanel2Layout); jPanel2Layout.setHorizontalGroup( jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGap(0, 466, Short.MAX_VALUE) ); jPanel2Layout.setVerticalGroup( jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGap(0, 242, Short.MAX_VALUE) ); jTabbedPane1.addTab("SSTF", jPanel2); javax.swing.GroupLayout jPanel3Layout = new javax.swing.GroupLayout(jPanel3); jPanel3.setLayout(jPanel3Layout); jPanel3Layout.setHorizontalGroup( jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGap(0, 466, Short.MAX_VALUE) ); jPanel3Layout.setVerticalGroup( jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGap(0, 242, Short.MAX_VALUE) ); jTabbedPane1.addTab("LOOK", jPanel3); javax.swing.GroupLayout jPanel4Layout = new javax.swing.GroupLayout(jPanel4); jPanel4.setLayout(jPanel4Layout); jPanel4Layout.setHorizontalGroup( jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGap(0, 466, Short.MAX_VALUE) ); jPanel4Layout.setVerticalGroup( jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGap(0, 242, Short.MAX_VALUE) ); jTabbedPane1.addTab("LOOK C", jPanel4); javax.swing.GroupLayout jPanel5Layout = new javax.swing.GroupLayout(jPanel5); jPanel5.setLayout(jPanel5Layout); jPanel5Layout.setHorizontalGroup( jPanel5Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGap(0, 466, Short.MAX_VALUE) ); jPanel5Layout.setVerticalGroup( jPanel5Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGap(0, 242, Short.MAX_VALUE) ); jTabbedPane1.addTab("SCAN", jPanel5); javax.swing.GroupLayout jPanel6Layout = new javax.swing.GroupLayout(jPanel6); jPanel6.setLayout(jPanel6Layout); jPanel6Layout.setHorizontalGroup( jPanel6Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGap(0, 466, Short.MAX_VALUE) ); jPanel6Layout.setVerticalGroup( jPanel6Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGap(0, 242, Short.MAX_VALUE) ); jTabbedPane1.addTab("SCAN C", jPanel6); getContentPane().add(jTabbedPane1, java.awt.BorderLayout.CENTER); jLabel1.setText("Distancia:"); jLabel2.setText("___________"); javax.swing.GroupLayout jPanel7Layout = new javax.swing.GroupLayout(jPanel7); jPanel7.setLayout(jPanel7Layout); jPanel7Layout.setHorizontalGroup( jPanel7Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(jPanel7Layout.createSequentialGroup() .addGap(21, 21, 21) .addComponent(jLabel1) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addComponent(jLabel2) .addContainerGap(331, Short.MAX_VALUE)) ); jPanel7Layout.setVerticalGroup( jPanel7Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(jPanel7Layout.createSequentialGroup() .addContainerGap() .addGroup(jPanel7Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(jLabel1) .addComponent(jLabel2)) .addContainerGap(15, Short.MAX_VALUE)) ); getContentPane().add(jPanel7, java.awt.BorderLayout.PAGE_START); pack(); }// </editor-fold> /** * @param args the command line arguments */ public static void main(String args[]) { /* Set the Nimbus look and feel */ //<editor-fold defaultstate="collapsed" desc=" Look and feel setting code (optional) "> /* If Nimbus (introduced in Java SE 6) is not available, stay with the default look and feel. * For details see http://download.oracle.com/javase/tutorial/uiswing/lookandfeel/plaf.html */ try { for (javax.swing.UIManager.LookAndFeelInfo info : javax.swing.UIManager.getInstalledLookAndFeels()) { if ("Nimbus".equals(info.getName())) { javax.swing.UIManager.setLookAndFeel(info.getClassName()); break; } } } catch (ClassNotFoundException ex) { java.util.logging.Logger.getLogger(NewJDialog.class.getName()).log(java.util.logging.Level.SEVERE, null, ex); } catch (InstantiationException ex) { java.util.logging.Logger.getLogger(NewJDialog.class.getName()).log(java.util.logging.Level.SEVERE, null, ex); } catch (IllegalAccessException ex) { java.util.logging.Logger.getLogger(NewJDialog.class.getName()).log(java.util.logging.Level.SEVERE, null, ex); } catch (javax.swing.UnsupportedLookAndFeelException ex) { java.util.logging.Logger.getLogger(NewJDialog.class.getName()).log(java.util.logging.Level.SEVERE, null, ex); } //</editor-fold> /* Create and display the dialog */ java.awt.EventQueue.invokeLater(new Runnable() { public void run() { NewJDialog dialog = new NewJDialog(new javax.swing.JFrame(), true); dialog.addWindowListener(new java.awt.event.WindowAdapter() { @Override public void windowClosing(java.awt.event.WindowEvent e) { System.exit(0); } }); dialog.setVisible(true); } }); } // Variables declaration - do not modify private javax.swing.JLabel jLabel1; private javax.swing.JLabel jLabel2; private javax.swing.JPanel jPanel1; private javax.swing.JPanel jPanel2; private javax.swing.JPanel jPanel3; private javax.swing.JPanel jPanel4; private javax.swing.JPanel jPanel5; private javax.swing.JPanel jPanel6; private javax.swing.JPanel jPanel7; private javax.swing.JTabbedPane jTabbedPane1; // End of variables declaration } This is another class that I have created for the paint method: package GUI; import java.awt.Graphics; import javax.swing.JPanel; /** * * @author TOSHIBA */ public class Lienzo { private int width = 5; private int height = 5; private int y = 5; private int x = 0; private int x1 = 0; public Graphics Draw(Graphics g, int[] pistas) { //Im not sure if this is the correct way to do it //The diagram gets drawn according to values from an array //The array is not always the same thats why I used the different Panels for (int i = 0; i < pistas.length; i++) { x = pistas[i]; x1 = pistas[i + 1]; g.drawOval(x, y, width, height); g.drawString(Integer.toString(x), x, y); g.drawLine(x, y, x1, y); } return g; } } I hope you guys understand what I am trying to do with my program.

    Read the article

  • GDI (2 replies)

    Hallo, I have a small (hopefully) problem... I defined an user control that in the Paint overriden method does the following things: protected override void OnPaint( PaintEventArgs e ) { e.Graphics.Clear( BackColor ); e.Graphics.SmoothingMode SmoothingMode; e.Graphics.CompositingQuality CompositingQuality; e.Graphics.InterpolationMode InterpolationMode; e.Graphics.TextRenderingHint TextRenderingHi...

    Read the article

  • CodePlex Daily Summary for Wednesday, May 19, 2010

    CodePlex Daily Summary for Wednesday, May 19, 2010New Projects3FD - Framework For Fast Development: This is a C++ framework that provides a solid error handling structure, garbage collection, multi-threading and portability between compilers. The ...ali test project: test projectAttribute Builder: The Attribute Builder builds an attribute from a lambda expression because it can.BDK0008: it is a food lovers websitecgdigest: cg digest template for non-profit orgCokmez: Bilmuh cokmez duyuru sistemiDot Game: It is a dot game that our Bangladeshi people used to play at their childhood time and their last time when they are poor for working.ESRI Javascript .NET Integration: Visual Studio project that shows how to integrate the Esri Javascript API with .NET Exchange 2010 RBAC Editor (RBAC GUI): Exchange 2010 RBAC Editor (RBAC GUI) Developed in C# and using Powershell behind the scenes RBAC tool to simplfy RBAC administrationFile Validator (Validador de Archivos): Componente que permite realizar la validación de archivos (txt, imagenes, PDF, etc) actualmente solo tiene implementado la parte de los txt, permit...Grip 09 Lab4: GripjPageFlipper: This is a wonderful implementation of page flipper entirely based on HTML 5 <canvas> tag. It means that it can work in any browser that supports HT...Main project: Index bird families and associated species. Malware Analysis and Can Handler: MACH is a tool to organize and catalog your malware analysis canned responses, and to track the topic response lifecycle for forum experts.Perf Web: Performance team web sitePiPiBugNet: PiPiBugNet是一套全新的开源Bug管理系统。 PiPiBugNet代码基于ASP.NET 2.0平台开发,编程语言为C#。 PiPiBugNet界面基于Ext JS设计,提供了极佳的用户体验。RemoteDesktop: integrated remote console, desktop and chat utilityRuneScape emulation done right.: RuneScape emulator.Sandkasten: SandkastenSilverlight Metro Theme: Metro Theme for Silverlight.Silverlight Stereoscopy: Stereoscopy with Silverlight.Twitivia: Twitivia is an online trivia service that runs through twitter and is being used as an example set of projects. C#, MVC, Windows Services, Linq ...XPool: A simple school project.New ReleasesDot Game: 'Dot Game' first release: Dot Game first release This is the 'Dot Game' first release.DotNetNuke® Store: 02.01.35: What's New in this release? Bugs corrected: - Fixed a resource for the header in the Category list of the Store Admin module. - Added several test...ESRI Javascript .NET Integration: Map search results in a DataView: Visual Studio 2010 example showing how to pass Map results back to ASP.NET for use in a DataView.Exchange 2010 RBAC Editor (RBAC GUI): RBAC Editor: This binary is still beta (0.0.9.1) but in most case it's very stableExtending C# editor - Outlining, classification: first revision: a couple of bug has been eliminated, performance improvementFloe IRC Client: Floe IRC Client 2010-05 R6: Corrected bug where text would be unexpectedly copied to the clipboard.Floe IRC Client: Floe IRC Client 2010-05 R7: - Fixed bug where text would show up in a query window with someone if they said something on a channel that you are both present on.Free Silverlight & WPF Chart Control - Visifire: Visifire SL and WPF Charts v3.0.9 GA released: Hi, Today we have released the final version of Visifire v3.0.9 which contains the following enhancements: * Two new properties ActualAxisMin...Free Silverlight & WPF Chart Control - Visifire: Visifire SL and WPF Charts v3.5.2 GA Released: Hi, Today we have released the final version of Visifire v3.5.2 which contains the following enhancements: Two new properties ActualAxisMinimum a...HB Batch Encoder Mk 2: HB Batch Encoder Mk2 v1.02: Added .mov support.jPageFlipper: jPageFlipper 0.9: This is an initial community preview of jPageFlipper. It's not ready for production usage but has almost all functionality implemented.linq.js - LINQ for JavaScript: ver 2.1.0.0: Add Class Dictionary Lookup Grouping OrderedEnumerable Add Method ToDictionary MemoizeAll Share Let Add Overload ...Microsoft Research Biology Extension for Excel: MSR Biology Extension for Excel - M9: M9 Release includes the following updates to the previous release: > Import / Export support from Excel for multiple file formats > Bug fixes and ...Nifty CSharp Tools: Event Watcher: Event Watcher!Paint.NET Bulk Image Processor: Paint.NET Bulk Image Processor v1.0: This is the initial release of the Paint.NET Bulk Image processor plugin. All feedback is welcome.PiPiBugNet: PiPiBugNet架构设计: PiPiBugNet架构设计,未包含功能实现RuneScape emulation done right.: rc0: Release cantidate 0.Rx Contrib: V1.6: Adding CCR queue as adapter for the ReactiveQueue credits goes to Yuval Mazor http://blogs.microsoft.co.il/blogs/yuvmaz/Silverlight Metro Theme: Silverlight Metro Theme Alpha 1: Silverlight Metro Theme Alpha 1Silverlight Stereoscopy: Silverlight Stereoscopy Alpha 1: Silverlight Stereoscopy Alpha 20100518Stratosphere: Stratosphere 1.0.6.0: Introduced support for batch put Introduced Support for conditional updates and consistent read Added support for select conditions Brought t...VCC: Latest build, v2.1.30518.0: Automatic drop of latest buildVideo Downloader: Example Program - 1.1: Example Program showing the features of the DLL and what can be achieved using it. For DLL Version 1.1.Video Downloader: Version 1.1: Version 1.1 See Home Page for usage and more information regarding new features. Please remember changes at You-Tube can prevent this software from...WatchersNET.TagCloud: WatchersNET.TagCloud 01.06.00: Whats New New Tag Mode: Show Tags from Ventrian.com NewsArticles Module New Tag Mode: Show Tags from Ventrian.com SimpleGallery Module Hyperlin...Windows Double Explorer: WDE v0.4: -optimization -switch to new vst2010 -viewer close now by pressing escape -reorder tabs -send selected fullname or shortnames via email (eye button...Most Popular ProjectsRawrWBFS ManagerAJAX Control ToolkitMicrosoft SQL Server Product Samples: DatabaseSilverlight ToolkitWindows Presentation Foundation (WPF)patterns & practices – Enterprise LibraryMicrosoft SQL Server Community & SamplesPHPExcelASP.NETMost Active Projectspatterns & practices – Enterprise LibraryRawrPHPExcelGMap.NET - Great Maps for Windows Forms & PresentationCustomer Portal Accelerator for Microsoft Dynamics CRMBlogEngine.NETWindows Azure Command-line Tools for PHP DevelopersCassiniDev - Cassini 3.5/4.0 Developers EditionSQL Server PowerShell ExtensionsFluent Ribbon Control Suite

    Read the article

  • Tower defence game poison tower in fieldrunners dynamics

    - by Syed Ali Haider Abidi
    I had made a 2d tower defence game in unity3d.done all the pathfinder tower upgrading cash stuff.now the dynamics. can one help me in making the dynamics of the paint tower..please remember as its a 2d game so i am working on spritesheets. This tower is more likely poison tower in fieldrunners.fow now i have only one image which follows the enemy but it remains the same but in fieldrunners its more realistic.it changes its direction when the enemies are on different angles.

    Read the article

  • Create Shortcuts for Your Favorite or Most Used Folders in Ubuntu

    - by Asian Angel
    Do you have certain folders that you access often each day but are only available through the Places Menu or Nautilus? See how easy it is to create shortcuts for your desktop and taskbar with our quick tutorial. To get started open Nautilus and locate the folders that you want to make new shortcuts for. For our example we chose Ubuntu One. Right click on the chosen folder and select Make Link. Your new shortcut will appear with the text Link to “Folder Name” and an Arrow Shortcut Marker attached. If you are happy with your new shortcut as is, then drag it to your desktop or taskbar as desired. We created the shortcut twice in our example…once for the desktop and once for the taskbar. For our example we decided to customize the taskbar shortcut a bit. To customize your shortcut right click on the shortcut and select Properties. Note: The desktop shortcut is limited on the amount you can customize it (name change and addition of up to four emblems to the folder). From here you can rename the shortcut and change the icon as desired. A quick name change and new icon made a huge improvement in how our taskbar shortcut looked. Note: The link for the icon we used is shown below. A little touch-up to our desktop shortcut and both are looking good. Download the Ubuntu Cloud Icon *Icon is 128*128 pixels and comes in .png format. Latest Features How-To Geek ETC Macs Don’t Make You Creative! So Why Do Artists Really Love Apple? MacX DVD Ripper Pro is Free for How-To Geek Readers (Time Limited!) HTG Explains: What’s a Solid State Drive and What Do I Need to Know? How to Get Amazing Color from Photos in Photoshop, GIMP, and Paint.NET Learn To Adjust Contrast Like a Pro in Photoshop, GIMP, and Paint.NET Have You Ever Wondered How Your Operating System Got Its Name? Create Shortcuts for Your Favorite or Most Used Folders in Ubuntu Create Custom Sized Thumbnail Images with Simple Image Resizer [Cross-Platform] Etch a Circuit Board using a Simple Homemade Mixture Sync Blocker Stops iTunes from Automatically Syncing The Journey to the Mystical Forest [Wallpaper] Trace Your Browser’s Roots on the Browser Family Tree [Infographic]

    Read the article

< Previous Page | 7 8 9 10 11 12 13 14 15 16 17 18  | Next Page >