paint

How to draw shapes in WP7 with the finger?

心已入冬 提交于 2020-01-02 07:41:10
问题 How to draw shapes in WP7 with the finger? I am trying to implement a simple paint application but I am not sure how to make the drawing. 回答1: fingerpaint is your friend try it out on Ruby using http://script.iron7.com/#/Script/Detail?scriptId=FingerPaint&userLowerCaseName=iron7 or in C# at http://sigurdsnorteland.wordpress.com/2010/10/20/fingerpaint-a-little-wp7-paint-app/ Note that the two sets of code aren't quite the same - the C# fingerpaint had some issues about drawing new tracks on

Java repaint not working correctly

回眸只為那壹抹淺笑 提交于 2020-01-02 04:39:10
问题 i use the java repaint method , it repaints, but the update is only seen when I either click on the canvas or resize the panel. How can I fix this ? What causes it? 回答1: You need to call the method revalidate(). This forces the layout manager to update / repaint all its components. 回答2: repaint() isn't actually repainting, it's just requesting a repaint of the component. 回答3: It may be helpful to simply grab the Graphics object from the component you wish to paint. Then just invoke a paint

How do I get the image paint/paintComponent generates?

与世无争的帅哥 提交于 2020-01-01 05:56:26
问题 I have a quick question. How do I get the image generated by a JComponent.paint or paintComponent? I have a JComponent which I use as a 'workspace' and where I have overwritten the paintComponent method to my own. The thing is that my workspace JComponent also has children which has their own paintComponent methods. So when Swing renders my workspace component, it renders the workspace graphics and then its childrens'. However, I want to get the image my workspace component generates (which

How do I get the image paint/paintComponent generates?

六月ゝ 毕业季﹏ 提交于 2020-01-01 05:56:14
问题 I have a quick question. How do I get the image generated by a JComponent.paint or paintComponent? I have a JComponent which I use as a 'workspace' and where I have overwritten the paintComponent method to my own. The thing is that my workspace JComponent also has children which has their own paintComponent methods. So when Swing renders my workspace component, it renders the workspace graphics and then its childrens'. However, I want to get the image my workspace component generates (which

Overriding the paint() method

ぐ巨炮叔叔 提交于 2019-12-31 05:29:06
问题 I've got a beginner question here that I was hoping someone with some Java experience could help me with. Currently taking an intro to OOP course focused on Java. My instructor is currently covering awt and swing, specifically the need to override the paint method so that graphics are redrawn when a window is resized, etc. I like to do as much outside reading as possible, and my concern is that the examples that my professor gives involve things that I've read are not best practices. To get

Java Swing heavy/slow paintComponent - any advice?

懵懂的女人 提交于 2019-12-31 04:10:59
问题 I'm making a scrolling 2D map/tile based game. Each tile (stored as tile[21][11] - 231 tiles total per map) can contain up to 21 values (stored as int[3][7]). While full-screen I see about 8 maps at once. On average, each map takes about 0.03 seconds to draw (found with System.nanoTime). The problem is that as soon as more than 1 map is on the screen, the Swing event polling noticeably slows down. Is there any solution to this? I can't draw the map a single time to save it as an image because

How to draw Windows Classic style window elements

狂风中的少年 提交于 2019-12-31 01:00:14
问题 We create a few custom 'windows' in our program and when VisualStyles are enabled we are able to find each element of the window and their size and paint them ourselves including the minimize and close buttons using the appropriate Renderers. We'd like to do that same thing when VisualStyles are disabled and currently draw our own windows but they're quite ugly. Is it possible in WinForms C# to draw the Windows Classic style windows? I've found the ClassicBorderDecorator but it's for WPF. Or,

Difference between Graphics object of getGraphics and paintComponent

谁说胖子不能爱 提交于 2019-12-30 12:13:15
问题 If I'm working with a JPanel, what's the difference between the Graphics object returned by getGraphics, and the Graphics object that is passed in paintComponent method? 回答1: getGraphics Can be null Is a "snap shot" of the last paint process Anything painted to it will be lost on the next paint cycle You should avoid using getGraphics and simply use what is past to the paintComponent method. In theory, there is no difference between them, but if you want what you have painted to survive

Using threads to paint panel in java

做~自己de王妃 提交于 2019-12-30 11:14:30
问题 I am writing a program that has a number of different views. One of which is fairly graphics intensive (it displays an interconnected graph). Others just display small but complex diagrams. I'm finding the paint time for the main view is quite long (even just painting the currently visible area) and while it is being painted, the rest of the interface becomes very slow. My question is this, can I create a new thread to handle the painting - and if so, will it result in a performance increase,

Get the text height including the font size and set that height

≡放荡痞女 提交于 2019-12-30 06:33:27
问题 i have a text called Hello now i need to apply fontsize for this say 12 or 18 now as soon as we apply font to the text the text size increases. so now i need to get the text height including the font size using paint. i have tried with paint the following: String finalVal ="Hello"; Paint paint = new Paint(); paint.setTextSize(18); paint.setTypeface(Typeface.SANS_SERIF); paint.setColor(Color.BLACK); paint.setStyle(Paint.Style.FILL); Rect result = new Rect(); // Measure the text rectangle to