Added a header to the category browser; removed some old setOpaque()

calls; made the chooser use most of the vertical height of the screen and
modified the split-pane to start with a 50/50 split.


git-svn-id: https://samskivert.googlecode.com/svn/trunk@1381 6335cc39-0255-0410-8fd6-9bcaacd3b74c
This commit is contained in:
mdb
2004-01-26 16:33:40 +00:00
parent 160cf7efba
commit fa549b8f0c
4 changed files with 31 additions and 14 deletions
@@ -1,5 +1,5 @@
//
// $Id: BrowsePanel.java,v 1.5 2004/01/26 16:10:55 mdb Exp $
// $Id: BrowsePanel.java,v 1.6 2004/01/26 16:33:40 mdb Exp $
package robodj.chooser;
@@ -10,6 +10,7 @@ import javax.swing.*;
import javax.swing.event.ListSelectionEvent;
import javax.swing.event.ListSelectionListener;
import com.samskivert.swing.GroupLayout;
import com.samskivert.util.CollectionUtil;
import robodj.repository.*;
@@ -33,6 +34,7 @@ public class BrowsePanel extends JPanel
public void valueChanged (ListSelectionEvent lse) {
Category cat = (Category)clist.getSelectedValue();
if (cat != null) {
_hlabel.setText(cat.name);
_category.setCategory(cat.categoryid);
}
}
@@ -40,9 +42,18 @@ public class BrowsePanel extends JPanel
clist.getSelectionModel().addListSelectionListener(lsl);
add(new JScrollPane(clist), BorderLayout.WEST);
add(_category = new CategoryEntryList(-1), BorderLayout.CENTER);
JPanel main = GroupLayout.makeVStretchBox(3);
add(main, BorderLayout.CENTER);
JPanel header = GroupLayout.makeButtonBox(GroupLayout.CENTER);
header.add(_hlabel = new JLabel());
_hlabel.setFont(getFont().deriveFont(18f));
main.add(header, GroupLayout.FIXED);
main.add(_category = new CategoryEntryList(-1));
clist.setSelectedIndex(cats.size()-1);
}
protected CategoryEntryList _category;
protected JLabel _hlabel;
}
@@ -1,10 +1,8 @@
//
// $Id: Chooser.java,v 1.13 2004/01/26 16:10:55 mdb Exp $
// $Id: Chooser.java,v 1.14 2004/01/26 16:33:40 mdb Exp $
package robodj.chooser;
import java.awt.Dimension;
import java.awt.Toolkit;
import java.io.IOException;
import java.util.Properties;
@@ -104,7 +102,7 @@ public class Chooser
// create our primary user interface frame, center the frame in
// the screen and show it
frame = new ChooserFrame();
frame.setSize(650, 665);
frame.setSize(660, frame.getToolkit().getScreenSize().height - 60);
SwingUtil.centerWindow(frame);
frame.setVisible(true);
}
@@ -1,5 +1,5 @@
//
// $Id: EntryList.java,v 1.14 2004/01/26 16:10:55 mdb Exp $
// $Id: EntryList.java,v 1.15 2004/01/26 16:33:40 mdb Exp $
package robodj.chooser;
@@ -25,8 +25,6 @@ public abstract class EntryList extends JSplitPane
{
super(JSplitPane.VERTICAL_SPLIT);
setOpaque(false);
setDividerLocation(200);
setLeftComponent(new JScrollPane(_bpanel = createPanel()));
setRightComponent(new JScrollPane(_epanel = createPanel()));
@@ -37,6 +35,19 @@ public abstract class EntryList extends JSplitPane
_controller = createController();
}
// documentation inherited
public void doLayout ()
{
super.doLayout();
// we only want to do this once so as not to mess with subsequent
// adjustments by the user
if (!_adjusted) {
setDividerLocation(0.5f);
_adjusted = true;
}
}
/**
* Creates a panel configured for displaying entries or songs.
*/
@@ -53,7 +64,6 @@ public abstract class EntryList extends JSplitPane
}
};
panel.setLayout(gl);
panel.setOpaque(false);
panel.setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 5));
return panel;
}
@@ -112,7 +122,6 @@ public abstract class EntryList extends JSplitPane
clearScrollPosition((JScrollPane)getLeftComponent());
// we've removed and added components so we need to revalidate
SwingUtil.setOpaque(_bpanel, false);
SwingUtil.refresh(_bpanel);
}
@@ -168,7 +177,6 @@ public abstract class EntryList extends JSplitPane
}
// we've removed and added components so we need to revalidate
SwingUtil.setOpaque(_epanel, false);
SwingUtil.refresh(_epanel);
}
@@ -182,6 +190,7 @@ public abstract class EntryList extends JSplitPane
protected JPanel _bpanel;
protected JPanel _epanel;
protected boolean _adjusted;
protected Font _titleFont;
protected static final String UP_TIP =
@@ -1,5 +1,5 @@
//
// $Id: PlaylistPanel.java,v 1.15 2004/01/26 16:10:55 mdb Exp $
// $Id: PlaylistPanel.java,v 1.16 2004/01/26 16:33:40 mdb Exp $
package robodj.chooser;
@@ -68,7 +68,6 @@ public class PlaylistPanel extends ControlledPanel
GroupLayout bgl = new HGroupLayout(GroupLayout.NONE);
bgl.setJustification(GroupLayout.RIGHT);
JPanel cbar = new JPanel(bgl);
cbar.setOpaque(false);
// add our control buttons
_clearbut = ButtonUtil.createControlButton(