We have to call revalidate() rather than repaint() when adding or removing
children or Swing doesn't quite do the right thing. git-svn-id: https://samskivert.googlecode.com/svn/trunk@352 6335cc39-0255-0410-8fd6-9bcaacd3b74c
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
//
|
||||
// $Id: EntryList.java,v 1.8 2001/09/21 03:09:01 mdb Exp $
|
||||
// $Id: EntryList.java,v 1.9 2001/10/12 18:21:27 mdb Exp $
|
||||
|
||||
package robodj.chooser;
|
||||
|
||||
@@ -203,9 +203,8 @@ public class EntryList
|
||||
// where we were... oh the complication.
|
||||
clearScrollPosition();
|
||||
|
||||
// we've removed and added components and swing won't properly
|
||||
// repaint automatically
|
||||
_bpanel.repaint();
|
||||
// we've removed and added components so we need to revalidate
|
||||
revalidate();
|
||||
}
|
||||
|
||||
protected void populateSong (Entry entry)
|
||||
@@ -275,9 +274,8 @@ public class EntryList
|
||||
// the song list
|
||||
clearScrollPosition();
|
||||
|
||||
// we've removed and added components and swing won't properly
|
||||
// repaint automatically
|
||||
_bpanel.repaint();
|
||||
// we've removed and added components so we need to revalidate
|
||||
revalidate();
|
||||
}
|
||||
|
||||
protected void clearScrollPosition ()
|
||||
@@ -336,6 +334,9 @@ public class EntryList
|
||||
// what's up
|
||||
_bpanel.add(new JLabel("Loading..."));
|
||||
|
||||
// we need to revalidate the component because we added a child
|
||||
revalidate();
|
||||
|
||||
// start up the task that reads the CD info from the database
|
||||
TaskMaster.invokeMethodTask("readEntries", this, this);
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
//
|
||||
// $Id: PlaylistPanel.java,v 1.8 2001/09/21 03:09:01 mdb Exp $
|
||||
// $Id: PlaylistPanel.java,v 1.9 2001/10/12 18:21:27 mdb Exp $
|
||||
|
||||
package robodj.chooser;
|
||||
|
||||
@@ -108,9 +108,9 @@ public class PlaylistPanel
|
||||
// what's up
|
||||
_bpanel.removeAll();
|
||||
_bpanel.add(new JLabel("Loading..."));
|
||||
// we've removed and added components and swing won't properly
|
||||
// repaint automatically
|
||||
_bpanel.repaint();
|
||||
// swing doesn't automatically validate after adding/removing
|
||||
// children
|
||||
_bpanel.revalidate();
|
||||
|
||||
// start up the task that reads the CD info from the database
|
||||
TaskMaster.invokeMethodTask("readPlaylist", this, this);
|
||||
@@ -265,9 +265,9 @@ public class PlaylistPanel
|
||||
_bpanel.add(new JLabel("Nothing playing."));
|
||||
}
|
||||
|
||||
// we've removed and added components and swing won't properly
|
||||
// repaint automatically
|
||||
_bpanel.repaint();
|
||||
// swing doesn't automatically validate after adding/removing
|
||||
// children
|
||||
_bpanel.revalidate();
|
||||
}
|
||||
|
||||
protected void highlightPlaying ()
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
//
|
||||
// $Id: ImporterFrame.java,v 1.5 2001/07/26 00:24:22 mdb Exp $
|
||||
// $Id: ImporterFrame.java,v 1.6 2001/10/12 18:21:27 mdb Exp $
|
||||
|
||||
package robodj.importer;
|
||||
|
||||
@@ -68,16 +68,18 @@ public class ImporterFrame extends JFrame
|
||||
abutton.setActionCommand(command);
|
||||
abutton.addActionListener(target);
|
||||
_buttonPanel.add(abutton);
|
||||
// swing doesn't properly repaint after adding/removing children
|
||||
_buttonPanel.repaint();
|
||||
// swing doesn't automatically validate after adding/removing
|
||||
// children
|
||||
_buttonPanel.revalidate();
|
||||
return abutton;
|
||||
}
|
||||
|
||||
public void clearControlButtons ()
|
||||
{
|
||||
_buttonPanel.removeAll();
|
||||
// swing doesn't properly repaint after adding/removing children
|
||||
_buttonPanel.repaint();
|
||||
// swing doesn't automatically validate after adding/removing
|
||||
// children
|
||||
_buttonPanel.revalidate();
|
||||
}
|
||||
|
||||
protected ImporterPanel _panel;
|
||||
|
||||
Reference in New Issue
Block a user