repaint

Invisible objects because repaint method - Java Swing

情到浓时终转凉″ 提交于 2019-12-11 04:02:34
问题 The problem comes because I overwrite the paintComponent method of a jPanel, so when I repaint all the objets are hidden till I focus them. I need to overwrite the paintComponent method cause it's the only one answer I'd found in internet to change the background image of a jFrame. So firstly I create a jPanel class: public class JPanelFondoPrincipal extends javax.swing.JPanel { public JPanelFondoPrincipal(){ this.setSize(800,500); } @Override public void paintComponent(Graphics g){ super

c++ repaint window

南楼画角 提交于 2019-12-11 03:28:33
问题 i got a window with an image in it. but when its a little picture i first need to resize the window before i can see it, the screen doesnt refresh/repaint. how can i fix this? 回答1: You can force a window to refresh by calling RedrawWindow 回答2: to repaint you should use the InvalidateRect(). it will send message to WM_REPAINT to force it repaint 回答3: This very much depends on what technology/tools you are using. On Windows, this is done by processing WM_PAINT message, or better, by using a 3rd

Erasing painted areas from translucent widgets in Qt

一笑奈何 提交于 2019-12-11 03:18:34
问题 I am faced with the problem of having to erase previously painted areas on a Qt widget. The basic idea is, the user selects an area of the screen by clicking and dragging the mouse and a rectangle is drawn over the selected area. The header class ClearBack : public QWidget { Q_OBJECT public: explicit ClearBack(const QPoint &startingPos); bool eventFilter(QObject *obj, QEvent *event); void paintEvent(QPaintEvent *); void mouseMoveEvent(QMouseEvent *event); signals: void regionSelected(const

Vertex labels painting outside of vertex, over scrollbars and onto other components when setLabelsClipped is true

隐身守侯 提交于 2019-12-11 02:47:48
问题 I've been working with JGraph for a while and it appears there is a painting issue when you set label clipping to true: The following boiled-down example shows the problem in a living application that you can mess with: import java.awt.BorderLayout; import java.awt.Dimension; import java.awt.event.ActionEvent; import javax.swing.AbstractAction; import javax.swing.JButton; import javax.swing.JFrame; import javax.swing.JPanel; import javax.swing.JSplitPane; import javax.swing.JTextArea; import

paintComponent is not working (Java)

瘦欲@ 提交于 2019-12-10 20:13:42
问题 I have been trying to override and use the paint component method instead of the paint method because I've seen it been suggested in multiple questions around here. I've looked through many questions but I still can't seem to get this to work. I'm posting my original piece of code used to render a screen. I am thinking that extending JFrame is not the right way to go and instead I need to extend JPanel, and use paint component from there. I have another object where I actually extend the

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

百般思念 提交于 2019-12-10 18:05:23
问题 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 works. I managed to whittle down the original code to get to the core of the problem and it now looks very different: I have two ColorPanel s that each draw a coloured square when you click on a panel the box should change colour in this order:

dynamically change color of custom graphic

拜拜、爱过 提交于 2019-12-10 17:29:03
问题 Problem: graphics aren't repainted until after methods are run. When button clicked two methods are called. Inside each method is code that is supposed to change the color of the graphic associated with this method (in the UI); when the method starts the graphic is changed from black to green; when the method finishes the color is changed from green to red. Then the next method is called and its graphic should turn green (method is running) and when the method finishes its graphic should be

IE10 Repaint/Redraw issue

两盒软妹~` 提交于 2019-12-10 14:07:18
问题 You can see this working/breaking here: http://new.campchampions.com/parents The issue only crops up in IE10. After the user has scrolled a little ways, the navigation becomes pinned (a class of fixed gets added to the body which effects the hgroup.primary (I know, I know hgroup is not a 'thing' anymore. Don't judge me.)). If you go back to the top of the page, it un-pins, goes back to normal. In IE10, when you go back up to the top of the page, the nav elements disappear until the mouse

Prevent repainting of window in C++

故事扮演 提交于 2019-12-10 12:57:54
问题 I am writing a global hook DLL that needs to do some drawing using GDI+ on a window in response to an event. My problem is that the window that is being drawn keeps repainting itself, so what I draw gets erased before I want it to. Is there any way I can prevent the window from painting anything for as long as I need to? My hook currently is a WH_CALLWNDPROC hook. The drawing is done using GDI+ in response to the message WM_SIZING . I drawing using GDI+ onto the window's DC (i.e. GetWindowDC

Java: how to remove specific object when button clicked

故事扮演 提交于 2019-12-10 12:18:29
问题 I'm trying to remove an object by clicking it's button, but what happens is when I click the button inside the panel it removes the last created panel. Question is how will I remove the specific panel that I want? Here's my code: public class TimerPractice extends JFrame implements ActionListener { JPanel main=new JPanel(); JPanel gui=new JPanel(); JButton btnadd=new JButton("Add Timer"); JPanel order=new JPanel(); public TimerPractice() { main.setLayout(new BorderLayout()); gui.setLayout(new