Search Results

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

Page 4/34 | < Previous Page | 1 2 3 4 5 6 7 8 9 10 11 12  | Next Page >

  • Creating Arrows Easily for Images

    - by Nitrodist
    I'm looking for a plugin or something along those lines for creating arrows for an image I'm working on. Basically it's just a screenshot of some software, but I want to annotate it and have arrows on it pointing to the various components. It should look something like this or even something simpler. The problem is that there doesn't seem to be an easy, free way of creating good arrows for any of the screenshots, short of importing actual images of arrows! I prefer to use: GIMP Paint.NET Other free software (beer or freedom, whichever) What are my alternatives? I really want to stay away from Photoshop on this. Thanks.

    Read the article

  • Automatically detect faces in a picture

    - by abel
    At my work place, passport sized photographs are scanned together, then cut up into individual pictures and saved with unique file numbers. Currently we use Paint.net to manually select, cut and save the pictures. I have seen Sony's Cybershot Camera has face detection. Google also gives me something about iphoto when searching for face detection. Picasa has facedetection too. Are there any ways to autodetect the faces in a document, which would improve productivity at my workplace by reducing the time needed to cut up individual images. Sample Scanned Document(A real document has 5 rows of 4 images each=20 pics): (from: http://www.memorykeeperphoto.com/images/passport_photo.jpg, fairuse) For eg. In Picasa 3.8, On clicking View People, all the faces are shown and I am asked to name them, can I save these individual pictures automatically with the names as different pictures.

    Read the article

  • How to configure mspaint on Windows Server 2008R2/ Win 7 to start up with 1-pixel canvas or auto-crop a pasted image?

    - by Fantomas
    I do a lot of screen print capturing, and I have just figured out how to use AutoHotKey to paste screen prints into MsPaint automatically. How to paste Print Screen on MS Paint automatically when press "PrtSc" button ? However, one small problem I have is that ... if I grabbed a screen with Alt-Prt Scr that is only 50x50 pixels, then there would be extra white margin around it, because MSPaint starts out with a larger canvas by default. How can I make it ALWAYS start with 1x1 instead?

    Read the article

  • Java - StackOverflow Error on recursive 2D boolean array method that shouldn't happen.

    - by David W.
    Hey everyone, I'm working on a runnable java applet that has a fill feature much like the fill method in drawing programs such as Microsoft Paint. This is how my filling method works: 1.) The applet gets the color that the user clicked on using .getRGB 2.) The applet creates a 2D boolean array of all the pixels in the window, with the value "true" if that pixel is the same color as the color clicked on or "false" if not. The point of this step is to keep the .getRGB method out of the recursive method to hopefully prevent this error. 3.) The applet recursively searches the 2D array of booleans where the user clicked, recording each adjacent point that is "true" in an ArrayList. The method then changes each point it records to false and continues. 4.) The applet paints every point stored in the ArrayList to a user selected color. All of the above steps work PERFECTLY if the user clicks within a small area, where only a few thousand pixels or so have their color changed. If the user selects a large area however (such as about 360,000 / the size of the applet window), the applet gets to the recursive stage and then outputs this error: Exception in thread "AWT-EventQueue-1" java.lang.StackOverflowError at java.util.ArrayList.add(ArrayList.java:351) at paint.recursiveSearch(paint.java:185) at paint.recursiveSearch(paint.java:190) at paint.recursiveSearch(paint.java:190) at paint.recursiveSearch(paint.java:190) at paint.recursiveSearch(paint.java:190) at paint.recursiveSearch(paint.java:190) at paint.recursiveSearch(paint.java:190) (continues for a few pages) Here is my recursive code: public void recursiveSearch(boolean [][] list, Point p){ if(isValid(p)){ if(list[(int)p.y][(int)p.x]){ fillPoints.add(p); list[(int)p.y][(int)p.x] = false; recursiveSearch(list, new Point(p.x-1,p.y));//Checks to the left recursiveSearch(list, new Point(p.x,p.y-1));//Checks above recursiveSearch(list, new Point(p.x+1,p.y));//Checks to the right recursiveSearch(list, new Point(p.x,p.y+1));//Checks below } } } Is there any way I can work around an error like this? I know that the loop will never go on forever, it just could take a lot of time. Thanks in advance.

    Read the article

  • Straight Line Equation between two points

    - by dafero
    Hi, I need to paint the line witch links two points. I developed my own solution using the straight line equation, but my results are different than using the "professional" programs (such as GIMP or even MS Paint). Here is a example of what I want: But my algorithm does this: *The green point is out of the figure and this is not possible. Any ideas? Anyone know which code is been using for this, in "professional" apps? Thanks! Daniel.

    Read the article

  • Painting component inside another component

    - by mike_hornbeck
    I've got a task to display painted 'eyes' with menu buttons to change their colors, and background color. Next animate them. But currently I'm stuck at painting, sinc in my JFrame I've Created JPanel containing panels with drawn eyes and buttons. Buttons are rendered properly but my eyes canvas is not shown. I've tried changing paint to paintComponent, setting contentPane differently but still nothing works. import java.awt.*; import javax.swing.*; public class Main extends JFrame { public static void main(String[] args) { final JFrame frame = new JFrame("Eyes"); frame.setPreferredSize(new Dimension(600, 450)); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); JPanel players = new JPanel(new GridLayout(1, 3)); players.add(new JButton("Eyes color")); players.add(new JButton("Eye pupil")); players.add(new JButton("Background color")); JPanel eyes = new JPanel(); Eyes e = new Eyes(); eyes.add(e); eyes.setPreferredSize(new Dimension(600, 400)); JPanel content = new JPanel(); content.setLayout(new BoxLayout(content, BoxLayout.Y_AXIS)); frame.setContentPane(content); content.add(players); content.add(eyes); // frame.getContentPane().add(content); frame.pack(); frame.setVisible(true); } } class Eyes extends JPanel { public Eyes(){ } public void paint(Graphics g) { super.paintComponent(g); Graphics2D g2d = (Graphics2D) g; g2d.setRenderingHint(RenderingHints.KEY_ANTIALIASING,RenderingHints.VALUE_ANTIALIAS_ON); BasicStroke bs = new BasicStroke(3.0f); g2d.setBackground(Color.green); g2d.setStroke(bs); g2d.setColor(Color.yellow); g2d.fillOval(50, 150, 200, 200); g2d.fillOval( 350, 150, 200, 200); g2d.setColor(Color.BLACK); g2d.drawOval(49, 149, 201, 201); g2d.drawOval(349, 149, 201, 201); g2d.fillOval(125, 225, 50, 50); g2d.fillOval(425, 225, 50, 50); } } This is what I should get : This is what I have : When I've tried painting it directly in JFrame it works almost perfect, apart of background not being set. Why setBackgroundColor doesn't influence my drawing in any way ?

    Read the article

  • Android map overly transparency has unwanted gradient

    - by DavidP2190
    I'm a making my first android app and for part of it I need some shaded areas over a mapview. I've got this working so far but the when I set the alpha of the fill colour, it goes strange. I'm not allowed to post images yet, but you can see what happens here: http://i.imgur.com/leXmc.png I'm not sure what causes it, but here is some code from where it gets drawn. public boolean draw(Canvas canvas, MapView mapView, boolean shadow, long when) { Paint paint = new Paint(); paint.setStrokeWidth(2); paint.setColor(android.graphics.Color.GREEN); paint.setStyle(Paint.Style.FILL_AND_STROKE); paint.setAlpha(25); screenPoints = new Point[10]; Path path = new Path(); for (int x = 0; x<greenZone.length; x++){ screenPoints[x] = new Point(); mapView.getProjection().toPixels(greenZone[x], screenPoints[x]); } path.moveTo(screenPoints[0].x, screenPoints[0].y); for (int x = 1; x < screenPoints.length-1; x++){ paint.setAlpha(25); if (x<9){ path.lineTo(screenPoints[x].x, screenPoints[x].y); canvas.drawPath(path, paint); } else{ path.moveTo(screenPoints[screenPoints.length-1].x, screenPoints[screenPoints.length-1].y); path.lineTo(screenPoints[0].x, screenPoints[0].y); canvas.drawPath(path, paint); } } return true; } Thanks.

    Read the article

  • how do I repaint an applet while moving a sprite?

    - by Nagrom_17
    I have a little java applet where I create 2 threads, one thread repaints and the other moves an image from a point to where the user clicks. The problem is that when I call the move function it loops until the image is where the user clicks but it wont repaint until I break out of the loop even though the thread doing the moving and the thread doing the painting are separate. shortened version of key points: my program is an applet using the paint() method I have 2 threads one moves an image and the other paints that image when I am moving the image it is in a while loop the painting thread is still calling repaint() but that is as far as the call goes, it never repaints thank you for your time.

    Read the article

  • Problem painting JLabel class to another JPanel class

    - by jjpotter
    I have created a class that extends JLabel to use as my object moving around a JPanel for a game. import javax.swing.*; public class Head extends JLabel { int xpos; int ypos; int xvel; int yvel; ImageIcon chickie = new ImageIcon("C:\\Users\\jjpotter.MSDOM1\\Pictures\\clavalle.jpg"); JLabel myLabel = new JLabel(chickie); public Head(int xpos, int ypos, int xvel, int yvel){ this.xpos = xpos; this.ypos = ypos; this.xvel = xvel; this.yvel = yvel; } public void draw(){ myLabel.setLocation(xpos, ypos); } public double getXpos() { return xpos; } public double getYpos() { return ypos; } public int getXvel() { return xvel; } public int getYvel() { return yvel; } public void setPos(int x, int y){ xpos = x; ypos = y; } } I am then trying to add it onto my JPanel. From here I will randomly have it increment its x and y coordinates to float it around the screen. I can not get it to paint itself onto the JPanel. I know there is a key concept I am missing here that involves painting components on different panels. Here is what I have in my GamePanel class import java.awt.Dimension; import java.util.Random; import javax.swing.*; public class GamePanel extends JPanel { Random myRand = new Random(); Head head = new Head(20,20,0,0); public GamePanel(){ this.setSize(new Dimension(640, 480)); this.add(head); } } Any suggestions on how to get this to add to the JPanel? Also, is this a good way to go about having the picture float around the screen randomly for a game?

    Read the article

  • Changing brightness in bufferedImage with DataBufferInt

    - by user2958025
    I must read some image and then I have to change brightness and contrast of this image I create main class and constructor where are panels, sliders and other stuff, I added changeListener to slider to take current value. My imagePanel is new Object of that class: public class Obrazek extends JPanel{ public static BufferedImage img = null; public Obrazek() { super(); try { img = ImageIO.read(new File("D:\\ja.jpg")); } catch (IOException e) {} } @Override public void paint(Graphics g) { g.drawImage(img, 0, 0, null); } } This is my load button private void przyciskWczytaj(java.awt.event.ActionEvent evt) { int odpowiedz = jFileChooser1.showOpenDialog(this); if (odpowiedz == jFileChooser1.APPROVE_OPTION) { File file = jFileChooser1.getSelectedFile(); try { BufferedImage im = ImageIO.read(new File(file.getAbsolutePath())); Obrazek.img = im; } catch (IOException ex) { System.out.println("Error"); } } } And now I want to create class where I will change that brightness. I have to use but I don't know how to use that thing: BufferedImage(256, 256, Bufferedmage.TYPE_INT_RGB) and to get each pixel of image I need to do something like: int rgb []=((DataBufferInt)img.getRaster().getDataBuffer()).getData(); And here I is next problem: How can I change the value of each r,g,b and show that new image on my panel

    Read the article

  • Friday Fun: Factory Balls – Christmas Edition

    - by Asian Angel
    Your weekend is almost here, but until the work day is over we have another fun holiday game for you. This week your job is to correctly decorate/paint the ornaments that go on the Christmas tree. Simple you say? Maybe, but maybe not! Factory Balls – Christmas Edition The object of the game is to correctly decorate/paint each Christmas ornament exactly as shown in the “sample image” provided for each level. What starts off as simple will quickly have you working to figure out the correct combination or sequence to complete each ornament. Are you ready? The first level serves as a tutorial to help you become comfortable with how to decorate/paint the ornaments. To move an ornament to a paint bucket or cover part of it with one of the helper items simply drag the ornament towards that area. The ornament will automatically move back to its’ starting position when the action is complete. First, a nice coat of red paint followed by covering the middle area with a horizontal belt. Once the belt is on move the ornament to the bucket of yellow paint. Next, you will need to remove the belt, so move the ornament back to the belt’s original position. One ornament finished! As soon as you complete decorating/painting an ornament, you move on to the next level and will be shown the next “sample Image” in the upper right corner. Starting with a coat of orange paint sounds good… Pop the little serrated edge cap on top… Add some blue paint… Almost have it… Place the large serrated edge cap on top… Another dip in the orange paint… And the second ornament is finished. Level three looks a little bit tougher…just work out your pattern of helper items & colors and you will definitely get it! Have fun decorating/painting those ornaments! Note: Starting with level four you will need to start using a combination of two helper items combined at times to properly complete the ornaments. Play Factory Balls – Christmas Edition Latest Features How-To Geek ETC The Complete List of iPad Tips, Tricks, and Tutorials The 50 Best Registry Hacks that Make Windows Better The How-To Geek Holiday Gift Guide (Geeky Stuff We Like) LCD? LED? Plasma? The How-To Geek Guide to HDTV Technology The How-To Geek Guide to Learning Photoshop, Part 8: Filters Improve Digital Photography by Calibrating Your Monitor Exploring the Jungle Ruins Wallpaper Protect Your Privacy When Browsing with Chrome and Iron Browser Free Shipping Day is Friday, December 17, 2010 – National Free Shipping Day Find an Applicable Quote for Any Programming Situation Winter Theme for Windows 7 from Microsoft Score Free In-Flight Wi-Fi Courtesy of Google Chrome

    Read the article

  • Android: canvas.drawBitmap with Orientation(MagnetField)Sensor

    - by user368374
    hallo, i am developing Android app with orientation sensor. now i got problem. What i want to do is, change scale and position of bitmap which read from sd card. The scale and position depend on value from orientation sensor. i use canvas.drawBitmap(), then it cause problem. the app is just shut down. other drawXXX()methods have no problem..any suggestion? public class AnMagImgtestActivity extends Activity implements SensorEventListener { private SensorManager sensorManager; private MySurfaceView view; @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); sensorManager = (SensorManager)getSystemService(SENSOR_SERVICE); view = new MySurfaceView(this); ///make it fullscreen getWindow().addFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN); requestWindowFeature(Window.FEATURE_NO_TITLE); ///give screen a hiropon getWindow().addFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON); setContentView(view); } @Override protected void onResume() { super.onResume(); List sensors = sensorManager.getSensorList(Sensor.TYPE_ORIENTATION); if (sensors.size() 0) { Sensor sensor = sensors.get(0); sensorManager.registerListener(this, sensor, SensorManager.SENSOR_DELAY_GAME); } } @Override protected void onPause() { super.onPause(); sensorManager.unregisterListener(this); } @Override public void onAccuracyChanged(Sensor sensor, int accuracy) { } @Override public void onSensorChanged(SensorEvent event) { view.onValueChanged(event.values); } class MySurfaceView extends SurfaceView implements SurfaceHolder.Callback{ public MySurfaceView(Context context) { super(context); getHolder().addCallback(this); } @Override public void surfaceChanged(SurfaceHolder holder, int format, int width, int height) { onValueChanged(new float[3]); } @Override public void surfaceCreated(SurfaceHolder holder) { } @Override public void surfaceDestroyed(SurfaceHolder holder) { } void onValueChanged(float[] values) { Canvas canvas = getHolder().lockCanvas(); //String imgfn = "/sdcard/seekcamera"+"/"+regcode+"/to"+"/"+tempnum+".jpg"; String imgfn = "/sdcard/seekcamera"+"/de"+"/to"+"1.jpg"; //String imgfn = "/sdcard/seekcamera"+"/00"+"/00"+"/"+"42.jpg"; File mf = new File(imgfn); Bitmap bitmap0 = BitmapFactory.decodeFile(mf.getPath()); if (canvas != null) { Paint paint = new Paint(); paint.setAntiAlias(true); paint.setColor(Color.GREEN); paint.setTextSize(12); canvas.drawColor(Color.BLACK); paint.setAlpha(200); for (int i = 0; i < values.length; i++) { canvas.drawText("values[" + i + "]: " + values[i], 0, paint.getTextSize() * (i + 1), paint); } paint.setColor(Color.WHITE); paint.setTextSize(100+values[2]); paint.setAlpha( (int) (255-values[2])); canvas.drawText("Germany", values[0]*1+20, paint.getTextSize() * 1+values[2]-80, paint); ///here is the problem.. canvas.drawBitmap(bitmap0, values[0],values[1], paint); getHolder().unlockCanvasAndPost(canvas); } } } }

    Read the article

  • Why cant i draw an elipse in with code?

    - by bvivek88
    package test; import java.awt.*; import java.awt.event.*; import java.awt.geom.Ellipse2D; import java.awt.image.BufferedImage; import javax.swing.*; public class test_bmp extends JPanel implements MouseListener,MouseMotionListener,ActionListener { static BufferedImage image; Color color; Point start=new Point(); Point end =new Point(); JButton elipse=new JButton("Elipse"); JButton rectangle=new JButton("Rectangle"); JButton line=new JButton("Line"); String selected; public test_bmp() { color = Color.black; setBorder(BorderFactory.createLineBorder(Color.black)); addMouseListener(this); addMouseMotionListener(this); } public void paintComponent(Graphics g) { //super.paintComponent(g); g.drawImage(image, 0, 0, this); Graphics2D g2 = (Graphics2D)g; g2.setPaint(Color.black); if(selected=="elipse") { g2.drawOval(start.x, start.y, (end.x-start.x),(end.y-start.y)); System.out.println("Start : "+start.x+","+start.y); System.out.println("End : "+end.x+","+end.y); } if(selected=="line") g2.drawLine(start.x,start.y,end.x,end.y); } //Draw on Buffered image public void draw() { Graphics2D g2 = image.createGraphics(); g2.setPaint(color); System.out.println("draw"); if(selected=="line") g2.drawLine(start.x, start.y, end.x, end.y); if(selected=="elipse") { g2.drawOval(start.x, start.y, (end.x-start.x),(end.y-start.y)); System.out.println("Start : "+start.x+","+start.y); System.out.println("End : "+end.x+","+end.y); } repaint(); g2.dispose(); } public JPanel addButtons() { JPanel buttonpanel=new JPanel(); buttonpanel.setBackground(color.lightGray); buttonpanel.setLayout(new BoxLayout(buttonpanel,BoxLayout.Y_AXIS)); elipse.addActionListener(this); rectangle.addActionListener(this); line.addActionListener(this); buttonpanel.add(elipse); buttonpanel.add(Box.createRigidArea(new Dimension(15,15))); buttonpanel.add(rectangle); buttonpanel.add(Box.createRigidArea(new Dimension(15,15))); buttonpanel.add(line); return buttonpanel; } public static void main(String args[]) { test_bmp application=new test_bmp(); //Main window JFrame frame=new JFrame("Whiteboard"); frame.setLayout(new BorderLayout()); frame.add(application.addButtons(),BorderLayout.WEST); frame.add(application); //size of the window frame.setSize(600,400); frame.setLocation(0,0); frame.setVisible(true); int w = frame.getWidth(); int h = frame.getHeight(); image = new BufferedImage(w, h, BufferedImage.TYPE_INT_RGB); Graphics2D g2 = image.createGraphics(); g2.setPaint(Color.white); g2.fillRect(0,0,w,h); g2.dispose(); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); } @Override public void mouseClicked(MouseEvent arg0) { // TODO Auto-generated method stub } @Override public void mouseEntered(MouseEvent arg0) { // TODO Auto-generated method stub } @Override public void mouseExited(MouseEvent arg0) { // TODO Auto-generated method stub } @Override public void mousePressed(MouseEvent event) { start = event.getPoint(); } @Override public void mouseReleased(MouseEvent event) { end = event.getPoint(); draw(); } @Override public void mouseDragged(MouseEvent e) { end=e.getPoint(); repaint(); } @Override public void mouseMoved(MouseEvent arg0) { // TODO Auto-generated method stub } @Override public void actionPerformed(ActionEvent e) { if(e.getSource()==elipse) selected="elipse"; if(e.getSource()==line) selected="line"; draw(); } } I need to create a paint application, when i draw elipse by dragging mouse from left to right it displays nothing, why?? should i use any other function here?

    Read the article

  • WinForms TabControl: How to avoid tab-rendering on DrawMode=OwnerDrawFixed?

    - by splattne
    I extended the (WindowsForms) built-in TabControl in order to implement closing tabs right on the tab itself ("x" image on the right like in Webbrowsers). The inherited control renders the text and images. Also, it uses visual styles on hover etc. All works very well, but I have one problem I can't solve. When the tabs are rendered, I cannot avoid that the Control paints the tabs another time as seen in this screenshot: That's a problem for two reasons: It looks ugly on the selected tab I'd like to increase the tabs' width because the current width doesn't take account of the "x" image on the right Any idea how to solve this?

    Read the article

  • Missing WM_PAINT when hosting a WPF control inside a winforms application.

    - by Boris
    Hi All, Consider the following scenario: 1) Create a winforms application with an empty form. 2) Create a WPF usercontrol in the same project which is just the default control with background changed to blue. <UserControl x:Class="WindowsFormsApplication2.UserControl1" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" Height="300" Width="300" Background="Blue"> <Grid> </Grid> </UserControl> 3) Build the project 4) Add the control to your form (an ElementHost is added and the control is added inside it). 5) Run the application (everything looks nice) 6) Start Spy++, click find window (Control+F) and move the cursor onto the WPF control (the blue square) Something strange happens, the control gets a WM_ERASEBKGND message but no WM_PAINT message so now it is white. You can resize the form, hide the form behind other windows and the WPF control will not get rendered. There is an image of the scenario here: http://img260.imageshack.us/img260/2296/wmpaint.png This is a simplified example of the situation I have in the actual application. Please tell me what is the best way to resolve this issue such that the WPF control renders itself correctly. I would like a solution that can be incorporated into a large application with many controls on the form. Thank you very much in advance, Boris

    Read the article

  • Resizing JPopupMenu and avoiding a "flicker" issue

    - by Avrom
    Hi, I am trying to implement a search results popup list similar to the style found here: http://www.inquisitorx.com/ (I'm not trying to implement a Google search, I'm just using this as a rough example of the style I'm working on.) In any event, I am implementing this by using a JList contained within a JPopupMenu which is popped up underneath a JTextField. When a user enters search terms, the list changes to reflect different matching results. I then call pack on the JPopupMenu to resize it. This works, however, it creates a slight flicker effect since it is actually hiding the popup and showing a popup. (See the private method getPopup in JPopupMenu where it explicitly does this.) Is there any way to just get it to just resize itself (aside from using a JWindow)?

    Read the article

  • Windows Phone Mango: Making a drawing app with various brushes option

    - by Md. Abdul Munim
    I am trying to make a drawing app. The purpose is simple. Let the user draw something on a canvas with various brush options like square brush,far brush,pencil brush and many more like any other drawing app available in android market. At present I can let the user draw smooth curves using following code: currentPoint = e.GetPosition(this.canvas); Line line = new Line() { X1 = currentPoint.X, Y1 = currentPoint.Y, X2 = oldPoint.X, Y2 = oldPoint.Y }; line.Stroke = new SolidColorBrush(Colors.Purple); line.StrokeThickness = 2; this.drawnImage.Add(line); this.canvas.Children.Add(line); oldPoint = currentPoint; Now I want some custom brush options and let the user draw using that.How can I achieve that? Thanks in advance.

    Read the article

  • JTabbedPane: only first tab is drawn, the second is always empty (newbie Q)

    - by paul
    I created a very simple JTabbedPane by first creating an empty JTabbedPane object, then 2 JPanels that I later add. Each JPanel is holding a object that extends JButton and implements MouseListener. Each of these holds a different image loaded from a file; the image is held locally as a buffered image and as an image icon, etc., all of which works great. The point of all that is to allow resizing of the image when the button is resized (using getscaledinstance()), because the panel is resized, because the JTabbedPane is resized, etc., within the JFrame that holds everything. I override paintComponent() to accomplish this in the class that extends JButton. I am using MigLayout Manager, and all is well on that front controlling layout constraints, growing, filling, initial sizes, preferred sizes, etc. The images the buttons hold are of different sizes and proportions, but this caused no trouble before. Up until 2 days ago everything worked fairly well. I made some changes trying to tweak some resizing issues as I was picking up MigLayout manager. At the time I was playing around with setting various min, max, and preferred sizes using the methods provided for by the components, not the layout manager. I also fooled a bit with pack(), validate(), visible(), opaque() etc., and yes I read the article about Swing and AWT painting here: http://java.sun.com/products/jfc/tsc/articles/painting/ , and I switched to relying more and more on MigLayout. On an unrelated note, it appears JFrame's do not honor maxsize? Somehow, today, with and without using any of these methods provided by swing, with or without using MigLayout manager to handle some of these matters instead, I now have a JTabbedPane that correctly displays the FIRST JPanel I add, but NOT THE SECOND JPanel--which, while present as a tab--does not show when selected. I have switched the order of which panel is added first, and this still holds true regardless of which JPanel I add first, telling me the JPanels are ok, and the problem is most likely in the JTabbedPane. I click on the second tab, the JTabbedPane switches, but I have what appears to be a blank button in the JPanel. A few console system-out statements reveal the following: a) that the second panel and its button are constructed b) no mouse events are being captured when I click on where the second panel and button should reside, as if it didn't exist at that point; c) when I switch to the second tab, the overrided paintComponent() method of the button within that second JPanel is never called, so it is in fact never being painted despite the tab in which it resides becoming visible; d) the JTabbpedPane getComponentCount() returns a correct value of 2 after adding the 2nd panel; e) MigLayout manager actually rocks, but I digress... I cannot now revert to my older code, and despite my best efforts to undo whatever changes caused this, I cannot fix my new problem. I've commented out everything but the most essential calls: constructors for each object--with MigLayout; add() for placing the buttons on the panels using string-arguments appropriate for MigLayout; add() for placing the panels on the JTabbedPane, also with MigLayout string arguments; setting the default op on close for the JFrame; and setting the JFrame visible. This means I do not fiddle with optimization settings, double buffering settings, opaque settings, but leave them as default, and still, no fix; the second panel will not show itself. Each panel, I should add, when it is the first to be loaded, works fine, again re-affirming that the panels and buttons are themselves ok. Here is part of what I am doing: //Note: BuildaButton is a class that merely constructs my instances File f = new File("/foo.jpg"); button1 = new BuildaButton().BuildaButton(f).buildfoo1Button(); f = new File("/foo2.jpg"); button2 = new BuildaButton().BuildaButton(f).buildfoo2Button(); MigLayout ml = new MigLayout("wrap 1", "[fill, grow]0[fill, grow]", "[fill, grow]0[fill, grow]"); MigLayout ml2 = new MigLayout("wrap 2", "[fill, grow]5[fill, grow]", "[fill, grow]0[fill, grow]"); foo1panel = new JPanel(ml); foo1panel.add(button1, "w 234:945:, h 200:807:"); foo2panel = new JPanel(ml); foo2panel.add(button2, "w 186:752:, h 200:807:"); tabs.add("foo1", foo1panel); tabs.add("foo2", foo2panel); System.out.println("contents of tabs: " + tabs.getComponentCount() + " elements"); mainframe.setLayout(ml2); mainframe.setMinimumSize(new Dimension(850,800)); mainframe.add(tabs, "w 600:800:, h 780:780:"); //controlpanel is a still blank jpanel that holds nothing--it is a space holder for now & will be utilized mainframe.add(controlpanel, "w 200:200:200, h 780:780:"); mainframe.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); mainframe.setVisible(true); Thank you in advance for any help you can give.

    Read the article

  • Creating collaborative whiteboard drawing application

    - by Steven Sproat
    I have my own drawing program in place, with a variety of "drawing tools" such as Pen, Eraser, Rectangle, Circle, Select, Text etc. It's made with Python and wxPython. Each tool mentioned above is a class, which all have polymorphic methods, such as left_down(), mouse_motion(), hit_test() etc. The program manages a list of all drawn shapes -- when a user has drawn a shape, it's added to the list. This is used to manage undo/redo operations too. So, I have a decent codebase that I can hook collaborative drawing into. Each shape could be changed to know its owner -- the user who drew it, and to only allow delete/move/rescale operations to be performed on shapes owned by one person. I'm just wondering the best way to develop this. One person in the "session" will have to act as the server, I have no money to offer free central servers. Somehow users will need a way to connect to servers, meaning some kind of "discover servers" browser...or something. How do I broadcast changes made to the application? Drawing in realtime and broadcasting a message on each mouse motion event would be costly in terms of performance and things get worse the more users there are at a given time. Any ideas are welcome, I'm not too sure where to begin with developing this (or even how to test it)

    Read the article

  • Simulating brush strokes for painting application

    - by DrRobot
    I'm trying to write an application that can be used to create pictures that look like paintings using simulated brush strokes. Are there any good sources for simple ways of simulating brush strokes? For example, given a list of mouse positions that the user has dragged the mouse through, a brush width and a brush texture, how do I determine what to draw to the canvas? I've tried angling the brush texture in the direction of the mouse movement and dabbing several brush texture images along the path, but it doesn't look great. I think I'm missing something where the brush texture should shrink and grow on corners. Any simple to follow links would be appreciated. I've found complex academic papers on simulating e.g. oil paints but I just want a basic algorithm to use that produces OK results if possible.

    Read the article

  • Java - Layering issues with Lists and Graphics2D

    - by Mirrorcrazy
    So I have a DisplayPanel class that extends JPanel and that also paints my numerous images for my program using Graphics2D. In order to be able to easily customly use this I set it up so that every time the panel is repainted it uses a List, that I can add to or remove from as the program processes. My problem is with layering. I've run into an issue where the List must have reached its resizing point (or something whacky like that) and so the images i want to display end up beneath all of the other images already on the screen. I've come to the community for an answer because I have faith you will provide a good one. DisplayPanel: package earthworm; import java.awt.Graphics; import java.awt.Graphics2D; import java.util.ArrayList; import java.util.List; import javax.swing.JPanel; public class DisplayPanel extends JPanel { private List<ImageMap> images = new ArrayList(); public DisplayPanel() { setSize(800, 640); refresh(); } public void refresh() { revalidate(); repaint(); } @Override public void paintComponent(Graphics g) { super.paintComponent(g); Graphics2D g2d = (Graphics2D) g; g2d.clearRect(0, 0, 800, 640); for(int i = 0; i < images.size(); i++) g2d.drawImage( images.get(i).getImage(), images.get(i).getX(), images.get(i).getY(), null); } public void paintImage(ImageMap[] images, ImageMap[] clearImages, boolean clear) { if(clear) this.images.clear(); else if(clearImages!=null) for(int i = 0; i < clearImages.length; i++) this.images.remove(clearImages[i]); if(images!=null) for(int i = 0; i<images.length; i++) this.images.add(images[i]); refresh(); } }

    Read the article

  • Is there a Swing JPanel toolbar background that fits all OSs?

    - by Nazgulled
    I'm using a JPanel to have a toolbar on my background, but I don't like the look of it. Actually, there's basically no look, no background and the buttons are flat when the mouse is not over them. This is on Windows. How can I have a better look for this? Something that would fit better on Windows? Maybe something like the ToolStrip in Visual Studio? Or maybe something better that would look much better depending on the OS version (Windows, Mac, Linux)? Suggestions?

    Read the article

  • Java Applet Buffering images

    - by Dan
    OK so here's my code: http://www.so.pastebin.com/Qca4ERmy I am trying to use buffers so the applet won't flicker upon redraw() but it seems I am having trouble. The applet still flickers.... Help? Thank you.

    Read the article

< Previous Page | 1 2 3 4 5 6 7 8 9 10 11 12  | Next Page >