paint

Prevent WPF window flicker

a 夏天 提交于 2019-11-29 15:07:54
I've got a borderless WPF window that needs to be able to hide one of its controls and shrink the window at the same time. The problem is that it looks terrible. Here's what I am doing now: private void btnShowHideTopBar_Click(object sender, RoutedEventArgs e) { if (commandTopHide == true) { txtblkShowHideTopBar.Text = "Show Top Bar"; commandTopHide = false; myWindow.Left = 1100; myWindow.Width = 180; RSide.Width = new GridLength(0, GridUnitType.Pixel); } else if (commandTopHide == false) { txtblkShowHideTopBar.Text = "Hide Top Bar"; commandTopHide = true; myWindow.Left = 1030; myWindow.Width

JLabel won't display image - NullPointerException

╄→尐↘猪︶ㄣ 提交于 2019-11-29 13:20:10
this is my first Java GUI program, and really only my second java program, so take it easy on me :) My program is a result of a lot of googling and reading java docs. My problem is that I have a sprite sheet of 52 cards, and am attempting to save these cards individually to a Buffered Image array using subImage, and just for testing purposes, display all 52 in a window. The File is in the correct directory I made sure of that. I believe that my problem lies with my use of Jlabels, or simply a foolish mistake. Anyways, here is my class that does the sprite sheet splitting package gui; import

Java - Calling paint method from different class?

霸气de小男生 提交于 2019-11-29 12:50:47
I have a class which extends JFrame and creates a window and it needs to call the paint() method which is in a different class. I understand that if they were in the same class, the setVisible(true) would call the paint method, but since they are in different classes, it does not. I have created objects of the Die class (the one painting), but I don't know how to use them to call the paint method. This is the class which creates the window: public class Game extends Frame { public void window() { setTitle("Roll"); // Title of the window setLocation(100, 100); // Location of the window setSize

Force immediate layout and paint in Swing

核能气质少年 提交于 2019-11-29 10:39:15
I cannot seem to force a layout in Swing. I have a JComponent added to a JLayeredPane and I set a border on the JComponent . Then, I want to immediately re-draw everything - not in the sense of "please do this asap" like invalidate() , but synchronously and immediately. Any help? I cannot seem to find the right method of doing this, and all my reading about invalidate(), validate(), repaint(), doLayout(), etc is just confusing me more! Jonathan According to this (see the section titled "Synchronous Painting") the paintImmediately() method should work. The most reliable way to get Swing to

How can I take a screenshot of a video, in android

China☆狼群 提交于 2019-11-29 10:17:25
问题 I have a video playing, and at some point, i need to pause the video, take a capture, and use then that image, to modify it, in a paint activity. The problem is that if, i try to save the video, the picture will be black (tried with setDrawingCacheEnabled(true); )........ Is it possible to take a screenshot of a video? 回答1: Have you tried ThumbnailUtils.createVideoThumbnail(String, int)? 回答2: Try this Link .. Hope it may help you Screen capture Bitmap saveBitmap = Bitmap.createBitmap

Easier way to make a paint application in java?

时间秒杀一切 提交于 2019-11-29 08:59:58
So basically I have some code I was working on a couple of days ago that is kind of like Paint, which allows you to essentially draw on the screen using the mouse. I kind of discovered this property by accident, and I realized that it is really inefficient and i'm wondering if there is a more practical way to do this. There isn't really any reason to give all of my code, but here are the important parts private static void createAndShowGui() { SimpleDraw mainPanel = new SimpleDraw(); MenuBar.createMenuBar(); JLabel label = new JLabel(); label.setText("Drawing prototype 0.0.1"); // label

Changing The Underlying Background Color Of A Swing Window

我的未来我决定 提交于 2019-11-29 07:09:03
问题 As discussed here, when resizing a Swing application in Vista (and Windows 7, which is what I'm using) you get a black background in the right/bottom corner while Swing's repaint catches up to the changes. Playing with other applications (Windows Explorer (Native), Firefox (C++?), and Eclipse (Java)) I notice that they all have this same problem - contrary to what the folks in the link above say - but they minimize the problem by having a grey fill color, which is far less visually jarring

Smooth window resizing in Windows (using Direct2D 1.1)?

爷,独闯天下 提交于 2019-11-29 06:14:50
It annoys me that the resizing of windows in Windows is not as "smooth" as it I'd like it to be (this is the case with Windows programs in general, not just my own. Visual Studio is a good example). It makes the OS and its programs feel "flimsy" and "cheap" (yes, I care about how programs and user interfaces feel , in the same way I care about the sound and feel of closing a car door. It's a reflection of build quality), which in my view affects the overall UX and ultimately the perception of the brand. The redrawing of window contents simply does not keep up with mouse movement during resize.

How to set paint.setColor(R.color.white)

耗尽温柔 提交于 2019-11-29 05:56:08
问题 I have a custom View that uses Paint and Canvas to draw objects. My question is how to set: int color = R.color.white; paint.setColor(color); from my /res/valuse/color.xml which includes resources like <?xml version="1.0" encoding="utf-8"?> <resources> <color name="white">#FFFFFF</color> <color name="black">#000000</color> ... </resources> 回答1: int color = ContextCompat.getColor(context, R.color.white); paint.setColor(color); The setColor() method takes a color number as int value, but not a

Paint/Draw on top of docked widgets in QDodckWidget

别说谁变了你拦得住时间么 提交于 2019-11-29 04:48:11
I have a class in Qt that inherits QDockWidget. And that class contains another widget. Is there any possibility to define a function in my QDockWidget inherited class that draws stuff on top of the contained widget? Like the painting to be independent of the contained widget but to be linked to the inherited class. Thank you Sure it's possible. It is fairly simple to do, in fact. You need to place a child widget that sits on top of everything else in your QDockWidget . To do it so, it must be the last child widget you add to your dockwidget. That widget must not to draw its background, and it