repaint

repaint(), revalidate(), invalidate(). How to use them?

只谈情不闲聊 提交于 2019-12-13 01:03:28
问题 I have problem with display of table. My table initially has rows. But next time if I do some operation my table list becomes empty. So when I add that model to the table the table is empty. It is empty but the display is showing white colour in table area. Initially the table looks like below figure. Then I need to call some action and if that action returns an empty list then I am creating a new Jtable with that list and placing it on the panel. But it is looking like the following.

Repainting JPanel after button click

Deadly 提交于 2019-12-12 21:31:37
问题 I'm new in Java Swing and I have a strange problem to refresh my JPanel . I create a static JPanel componant in my frame and I call a static method from a FileListenner to repaint my JPanel public static void repaintPlan(JPanel f) { f.paint(f.getGraphics()); f.revalidate(); // or validate } I mean, when I detect change in file content, I calculate the new coordinates and I repaint the JPanel (I create a class exends from JPanel to define paintComponent()` method) Everything is working fine

My JFrame Flickers

筅森魡賤 提交于 2019-12-12 15:23:26
问题 I'm trying to make a simple java game -- driving a car through a track. I am conditioned by my teacher to use rectangles and stuff like that . My problem is when I use the method repaint() that my frame flickers. I have tried to put the repaint method just when the car changes direction, but it doesn't do any good. Any suggestions? import java.awt.Color; import java.awt.Graphics; import java.awt.Image; import java.awt.Rectangle; import java.awt.Toolkit; import java.awt.event.KeyEvent; import

smooth scrolling .net forms

不羁的心 提交于 2019-12-12 12:18:34
问题 Hi I am using forms in .net and i am adding lots of linked labels dynamically during runtime, I am adding these linklabels to panel and adding that panel to the winform. When the no of linklabels increases the form puts out an auto scrollbar(vertical)... Now when i scroll down using that autoscroll the form is not updating its view as i scroll, the form gets refreshed only when i stop scrolling... Also when it refresh it looks too bad.. i can see how it draws slowly.... Has anyone dealt with

Java Transparency rendering error

蹲街弑〆低调 提交于 2019-12-12 08:43:27
问题 I am currently developing a kiosk style Java program to display weather, time, forecast etc. Here is a shot of what the program should look like (screenshot taken before the time updated) The various sections are created as JPanels with the paintComponent() method overridden. They draw in a gradient header and a semitransparent background. However, when I change the content of one of these panels, the previous content is left behind, rather than being removed. An example is shown below: As

How to change controls simultaneously without repainting each one?

走远了吗. 提交于 2019-12-12 07:58:06
问题 For example I need to disable two buttons in runtime. After I disabled first button it bacame gray, the second - it also became gray. But I do not know how to make the repainting simultaneous! I need something like that: freeze the Form (disable repainting) disable first button disable second button Enable Form repainting How to implement that? 回答1: Look at the Win32 API WM_SETREDRAW message. For example: SendMessage(Handle, WM_SETREDRAW, False, 0); Button1.Enabled := False; Button2.Enabled :

Why doesn't this Java paint program paint more than one oval?

蓝咒 提交于 2019-12-12 02:56:59
问题 I have a Java paint program that uses a custom JPanel to paint on. While when clicking on the JPanel paints a small oval (or circle, if you will), the oval disappears each time you click on another place. The coordinates also get updated, but the oval does not stay, it moves to wherever the user clicks next... Here's the code for the custom JPanel: int xCord, yCord; public class PaintPanel extends JPanel implements MouseListener { // default serial whatever... private static final long

How to repaint a UITextView for iPhone 3.x after updating data programmatically

99封情书 提交于 2019-12-12 01:44:06
问题 In my app I update a textView programmatically. I actually loop through a dataset from a SQLITE3 DB and show a specific text for a given time. Then I would like to show the text from the next dataset record and so forth. I have been browsing through all kind of forums and the apple doc as well, but could not find anything like a repaint, refresh, updateTextView or so command. I am dealing with long strings, why I thought the UITextView would be the best way to display. However, if another UI

Updating jlabel temperature on the gui in java when temperature is updated

北战南征 提交于 2019-12-12 00:56:13
问题 Hi I am trying to create a gui that will update the temperature every time the temperature sensor sends back a signal and update the jlabel value. Right now I am able to update the gui label by pressing the update button, however i want it to update automatically without pressing the "update button". I have tried a lot of method including repaint() , and revalidate() , and using different type of swing timers but still cannot get it to work. Can someone please help me out here? Thanks I will

Refresh Swing GUI

允我心安 提交于 2019-12-11 19:48:43
问题 I have a Board that contains tiles and the Tiles contain Obstacles. An obstacle can be one of the several types (wall, laser, ...). Every round of the game I execute the board, which exectutes all the Obstacles. Once an obstacle has been executed and something has changed the GUI is notified and the affected tiles are refreshed. In the GUI a tile is an OverLayLayout that contains overlapping images (JLabels), so all the overlapping images are visible. Now the problem is when I execute them,