repaint

repaint components in a loop

白昼怎懂夜的黑 提交于 2020-02-25 04:18:28
问题 I'm creating a simple game and I'd like to repaint the board after every move. So, after I call move(), what I would like to do is this: (by the way, a View is a JComponent that holds pieces; since the number of pieces has changed after the move, it needs to be repainted) for(View v : views){ v.repaint(); } It's not working. When I call repaint() on a single View, it works fine. I tried using paintImmediately , and revalidate , and update ... nothing works within the loop. Any ideas? Thanks

java paint problem - black components

荒凉一梦 提交于 2020-02-24 07:51:19
问题 I am having a weird java problem - For some reason quite often when I open a dialog it becomes black. When I force a repaint (for example, draging it out and into the screen again) it draws itself normaly again. The problem seems to occur only on my computer (The same code works for a friend), and its not just one class - it seems that almost every dialogs I open (on different projects) gets this problem. Even JOptionPane.showMessageDialog() gets this problem. Even weirder, it even happens

java paint problem - black components

旧巷老猫 提交于 2020-02-24 07:50:31
问题 I am having a weird java problem - For some reason quite often when I open a dialog it becomes black. When I force a repaint (for example, draging it out and into the screen again) it draws itself normaly again. The problem seems to occur only on my computer (The same code works for a friend), and its not just one class - it seems that almost every dialogs I open (on different projects) gets this problem. Even JOptionPane.showMessageDialog() gets this problem. Even weirder, it even happens

java JFrame update amends another JFrame

蓝咒 提交于 2020-01-30 11:12:09
问题 I have a screen ( JFrame ) that picks up some of its initial population from a file. However, if the file is for some reason absent or incorrectly populated then many fields are blocked as non-editable and user is forced to click a settings button, which generates another JFrame screen. If the user then updates the file correctly I want the original screen to be re-populated with the new file data, can this be done? So I have an action listener for the settings button, which calls Java class

java JFrame update amends another JFrame

坚强是说给别人听的谎言 提交于 2020-01-30 11:12:05
问题 I have a screen ( JFrame ) that picks up some of its initial population from a file. However, if the file is for some reason absent or incorrectly populated then many fields are blocked as non-editable and user is forced to click a settings button, which generates another JFrame screen. If the user then updates the file correctly I want the original screen to be re-populated with the new file data, can this be done? So I have an action listener for the settings button, which calls Java class

Repainting a JPanel in a loop with a delay

荒凉一梦 提交于 2020-01-15 08:35:10
问题 I'm trying to create a program which will visualize different sorting algorithms by drawing a set of bars representing an array along for each time the sort loops. However, when I set the array from within the sorter class which in turn repaints the panel, it seems that it only calls paintComponent() for the first and last iteration, not showing the steps in between. Here is the sort code which calls the setNumberArray() method: public void bubbleSort() { int[] x = getNumberArray(); boolean

Why are my custom graphical items constantly repainting in a Qt-based C++ GUI application?

别说谁变了你拦得住时间么 提交于 2020-01-15 03:26:09
问题 My application has a QMdiArea, inside which subwindows are shown which contain instances of QGraphicsView-derived views (GfxInteractiveView), which in turn visualize scenes containing custom QGraphicsItem-derived items. /// An image item which is displayed as the background of a scene. class GfxImageItem : public QObject, public QGraphicsPixmapItem { Q_OBJECT protected: GfxInteractiveImgView *view_; QPixmap pixmap_; QList<GfxPointItem *> pointItems_; public: GfxImageItem(GfxInteractiveImgView

How to make repaint for JDialog in Swing?

≡放荡痞女 提交于 2020-01-11 12:03:20
问题 How to make repaint for JDialog in Swing? If I click on convert button in JDialog I need to change GUI design of JDialog but it's not happening? Is their any solution? _convertAction = new AbstractAction() { public void actionPerformed(ActionEvent e) { String para = new String(); _task.setBookTypeId(13); initComponents(); // validate(); // repaint(); setVisible(true); } }; I'm setting booking type id is 13 . if(_task.getBookTypeId()== 1){ String colnames[] = {"Leg","Departure", "Date","Time",

workaround for display block and css transitions work properly

被刻印的时光 ゝ 提交于 2020-01-07 00:35:21
问题 CSS transitions will not apply if you set the display property of an element to block immediately before changing the property with the transition attached. You can see the issue in the following example: var dom = {}; dom.creative = document.getElementById('creative'); dom.creative.style.display = 'block'; dom.creative.style.opacity = 1; #creative { display: none; opacity: 0; transition: opacity 2s; } <div id="creative"> <span>Sample text</span> </div> The issue can be fixed by forcing a

(Java) Component not showing on Panel

杀马特。学长 韩版系。学妹 提交于 2020-01-06 15:04:56
问题 I know this question was asked many times and frequently answered, i read some hours on this topic trying to get following to work, but couldn't manage to get it running. I want to show the user a panel where he or she can click on to select points, remember the coordinates and do some stuff with them later. I want to show the points when clicked, but they just don't show up. The frame I paint around the panel does show up, but the points I set don't. Would be glad for any advice given, im