Questions tagged [repaint]

Repaint refers to issues relating to re-rendering or redrawing user interface screens or portions of those screens.

Repaint is the process of re-rendering or redrawing user interface screens or portions of those screens. A number of different paint techniques may be employed in 2-D or 3-D graphics.

1282 questions
3
votes
2 answers

Repaint components in JOptionPane

I Have some part of view which show text fields in JOptionPane. And there is a button "other". After click on it I need JOptionPane repaint itself and show some hidden text fields. I use GridLayout for my text fields. I tried revalidate() and…
dimads
  • 77
  • 6
3
votes
1 answer

Generating specific shapes with random dimensions using a JComboBox to select shapes

I am trying to create a program that uses a JComboBox containing specific shapes (Circle, Square, Oval, Rectangle). After the user clicks on a specified shape, the Panel will display 20 of that shape in random dimensions and locations. I am having…
E. My
  • 35
  • 4
3
votes
1 answer

Is it truly never okay to call Component.getGraphics?

MadProgrammer made a comment here stating that you should NEVER EVER use Component.getGraphics, which I generally agree with: In virtually all situations, it is wrong. But take the case of this class I created years ago. I'm posting what I think is…
ControlAltDel
  • 33,923
  • 10
  • 53
  • 80
3
votes
4 answers

QGraphicsItem repaint

I want to change text color inside a rectangle periodically. Here is my trial: TrainIdBox::TrainIdBox() { boxRect = QRectF(0,0,40,15); testPen = QPen(Qt:red); i=0; startTimer(500); } QRectF TrainIdBox::boundingRect() const { return…
onurozcelik
  • 1,214
  • 3
  • 21
  • 44
3
votes
1 answer

Java repaint() not calling paintComponent()

In an attempt to make a very simple bullet-hell game to learn about java, I ran into a roadblock: repaint() wasn't calling paintComponent(). Here is the entire program, which for now simply draws an image I created 50 times per second onto a JPanel,…
Nematodes
  • 33
  • 1
  • 5
3
votes
1 answer

My repaint in JFrame is not working

I have a problem with repaint in JFrame i used repaint() earlier when i was making an animation and everything worked import java.awt.*; import java.awt.event.*; import javax.swing.*; public class Draw extends JComponent implements KeyListener { …
Oktavix
  • 151
  • 1
  • 2
  • 9
3
votes
1 answer

How to stop a MFC/win32 control re-painting

I have a CRichEditCtrl, and an algorithm works on its contents in-place, iterating through the contents and making changes. This seems to cause it to re-paaint every time, which causes flickering and a noticeable time to complete the operation,…
Mr. Boy
  • 60,845
  • 93
  • 320
  • 589
3
votes
2 answers

My Jtable doesnt refresh

I create a simple register form to add Name, Gender and city to the table, but i got some problem here. My table only will refresh when i click the maximize button on the left top of my form. here is the code: http://pastebin.com/dFnix5NY package…
3
votes
1 answer

JLabels in GridLayout are Not Always Painted

I am creating a basic Tic-Tac-Toe application in Java Swing, and for this purpose, I have started investigating drawing. However, I have encountered an issue when a subclass of JPanel contains more than one instance of a subclass of JLabel, which…
lassekokholm
  • 97
  • 1
  • 1
  • 6
3
votes
1 answer

Artifacts showing when modifying a custom QGraphicsItem

I'm currently developping a small vector drawing program in wich you can create lines and modify them after creation (those lines are based on a custom QGraphicsItem). For instance, the picture below shows what happens when the leftmost (marked…
thomasc
  • 935
  • 9
  • 18
3
votes
1 answer

paintComponent() gets called only when Minimizing-Maximizing Screen

I am trying to develop a game in which I need to draw a grid. For that I am using the paintComponent(Graphics g) method which is being called by repaint() method. The problem is that the repaint method is inside the infinite While loop and it never…
Manpreet
  • 570
  • 5
  • 20
3
votes
3 answers

Java repaint is slow under certain conditions

I'm doing a simple grid which each square is highlighted by the cursor: They are a couple of JPanels, mapgrid and overlay inside a JLayeredPane, with mapgrid on the bottom. Mapgrid just draws on initialization the grid, its paint metodh is: public…
Gabriel
  • 5,453
  • 14
  • 63
  • 92
3
votes
1 answer

How does multi arg version of repaint works in Java?

I am reading the custom painting tutorial in Java which talks about paint and repaint methods. In this tutorial, repaint method is called with multiple arguments as variable values used in calculations in the method. So, what is the purpose of…
Ambidextrous
  • 882
  • 2
  • 12
  • 26
3
votes
2 answers

Why does this this Swing bug occur when using repaint() and not with getParent().repaint()?

This question is based on a problem I had a while back with a simple Swing dice program. The original question I posted is here and has an accepted answer, but I'd like to know exactly what is happening, why the problem occurs, and why the solution…
mallardz
  • 1,070
  • 11
  • 21
3
votes
1 answer

Redrawing JFrame lag/pop-in

I have an issue with redrawing a JFrame that contains hundreds of JFrames inside it. I have an application that draws a "tile based" map and each tile is a JFrame. When I try to revalidate and redraw the JFrame you can visibly see random tiles…
deadfire19
  • 329
  • 2
  • 16