use of javax.swing.plaf.basic.BasicSplitPaneUI in project libgdx by libgdx.
the class ParticleEditor method initializeComponents.
private void initializeComponents() {
// {
// JMenuBar menuBar = new JMenuBar();
// setJMenuBar(menuBar);
// JPopupMenu.setDefaultLightWeightPopupEnabled(false);
// JMenu fileMenu = new JMenu("File");
// menuBar.add(fileMenu);
// }
splitPane = new JSplitPane();
splitPane.setUI(new BasicSplitPaneUI() {
public void paint(Graphics g, JComponent jc) {
}
});
splitPane.setDividerSize(4);
getContentPane().add(splitPane, BorderLayout.CENTER);
{
JSplitPane rightSplit = new JSplitPane(JSplitPane.VERTICAL_SPLIT);
rightSplit.setUI(new BasicSplitPaneUI() {
public void paint(Graphics g, JComponent jc) {
}
});
rightSplit.setDividerSize(4);
splitPane.add(rightSplit, JSplitPane.RIGHT);
{
JPanel propertiesPanel = new JPanel(new GridBagLayout());
rightSplit.add(propertiesPanel, JSplitPane.TOP);
propertiesPanel.setBorder(new CompoundBorder(BorderFactory.createEmptyBorder(3, 0, 6, 6), BorderFactory.createTitledBorder("Editor Properties")));
{
JScrollPane scroll = new JScrollPane();
propertiesPanel.add(scroll, new GridBagConstraints(0, 0, 1, 1, 1, 1, GridBagConstraints.NORTH, GridBagConstraints.BOTH, new Insets(0, 0, 0, 0), 0, 0));
scroll.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 0));
{
editRowsPanel = new JPanel(new GridBagLayout());
scroll.setViewportView(editRowsPanel);
scroll.getVerticalScrollBar().setUnitIncrement(70);
}
}
}
{
JPanel propertiesPanel = new JPanel(new GridBagLayout());
rightSplit.add(propertiesPanel, JSplitPane.BOTTOM);
propertiesPanel.setBorder(new CompoundBorder(BorderFactory.createEmptyBorder(3, 0, 6, 6), BorderFactory.createTitledBorder("Emitter Properties")));
{
JScrollPane scroll = new JScrollPane();
propertiesPanel.add(scroll, new GridBagConstraints(0, 0, 1, 1, 1, 1, GridBagConstraints.NORTH, GridBagConstraints.BOTH, new Insets(0, 0, 0, 0), 0, 0));
scroll.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 0));
{
rowsPanel = new JPanel(new GridBagLayout());
scroll.setViewportView(rowsPanel);
scroll.getVerticalScrollBar().setUnitIncrement(70);
}
}
}
rightSplit.setDividerLocation(200);
}
{
JSplitPane leftSplit = new JSplitPane(JSplitPane.VERTICAL_SPLIT);
leftSplit.setUI(new BasicSplitPaneUI() {
public void paint(Graphics g, JComponent jc) {
}
});
leftSplit.setDividerSize(4);
splitPane.add(leftSplit, JSplitPane.LEFT);
{
JPanel spacer = new JPanel(new BorderLayout());
leftSplit.add(spacer, JSplitPane.BOTTOM);
spacer.add(lwjglCanvas.getCanvas());
spacer.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 4));
}
{
JPanel emittersPanel = new JPanel(new BorderLayout());
leftSplit.add(emittersPanel, JSplitPane.TOP);
emittersPanel.setBorder(new CompoundBorder(BorderFactory.createEmptyBorder(0, 6, 6, 0), BorderFactory.createTitledBorder("Effect Emitters")));
{
effectPanel = new EffectPanel(this);
emittersPanel.add(effectPanel);
}
}
leftSplit.setDividerLocation(575);
}
splitPane.setDividerLocation(325);
}
use of javax.swing.plaf.basic.BasicSplitPaneUI in project libgdx by libgdx.
the class FlameMain method initializeComponents.
private void initializeComponents() {
splitPane = new JSplitPane();
splitPane.setUI(new BasicSplitPaneUI() {
public void paint(Graphics g, JComponent jc) {
}
});
splitPane.setDividerSize(4);
getContentPane().add(splitPane, BorderLayout.CENTER);
{
JSplitPane rightSplit = new JSplitPane(JSplitPane.VERTICAL_SPLIT);
rightSplit.setUI(new BasicSplitPaneUI() {
public void paint(Graphics g, JComponent jc) {
}
});
rightSplit.setDividerSize(4);
splitPane.add(rightSplit, JSplitPane.RIGHT);
{
JPanel propertiesPanel = new JPanel(new GridBagLayout());
rightSplit.add(propertiesPanel, JSplitPane.TOP);
propertiesPanel.setBorder(new CompoundBorder(BorderFactory.createEmptyBorder(3, 0, 6, 6), BorderFactory.createTitledBorder("Editor Properties")));
{
JScrollPane scroll = new JScrollPane();
propertiesPanel.add(scroll, new GridBagConstraints(0, 0, 1, 1, 1, 1, GridBagConstraints.NORTH, GridBagConstraints.BOTH, new Insets(0, 0, 0, 0), 0, 0));
scroll.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 0));
{
editorPropertiesPanel = new JPanel(new GridBagLayout());
scroll.setViewportView(editorPropertiesPanel);
scroll.getVerticalScrollBar().setUnitIncrement(70);
}
}
}
{
JSplitPane rightSplitPane = new JSplitPane(JSplitPane.VERTICAL_SPLIT);
rightSplitPane.setUI(new BasicSplitPaneUI() {
public void paint(Graphics g, JComponent jc) {
}
});
rightSplitPane.setDividerSize(4);
rightSplitPane.setDividerLocation(100);
rightSplit.add(rightSplitPane, JSplitPane.BOTTOM);
JPanel propertiesPanel = new JPanel(new GridBagLayout());
rightSplitPane.add(propertiesPanel, JSplitPane.TOP);
propertiesPanel.setBorder(new CompoundBorder(BorderFactory.createEmptyBorder(3, 0, 6, 6), BorderFactory.createTitledBorder("Influencers")));
{
JScrollPane scroll = new JScrollPane();
propertiesPanel.add(scroll, new GridBagConstraints(0, 0, 1, 1, 1, 1, GridBagConstraints.NORTH, GridBagConstraints.BOTH, new Insets(0, 0, 0, 0), 0, 0));
scroll.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 0));
{
JPanel influencersPanel = new JPanel(new GridBagLayout());
influencerBox = new JComboBox(new DefaultComboBoxModel());
JButton addInfluencerButton = new JButton("Add");
addInfluencerButton.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
InfluencerWrapper wrapper = (InfluencerWrapper) influencerBox.getSelectedItem();
ParticleController controller = getEmitter();
if (controller != null)
addInfluencer(wrapper.type, controller);
}
});
influencersPanel.add(influencerBox, new GridBagConstraints(0, 0, 1, 1, 0, 1, GridBagConstraints.NORTHWEST, GridBagConstraints.NONE, new Insets(0, 0, 0, 0), 0, 0));
influencersPanel.add(addInfluencerButton, new GridBagConstraints(1, 0, 1, 1, 1, 1, GridBagConstraints.NORTHWEST, GridBagConstraints.NONE, new Insets(0, 0, 0, 0), 0, 0));
scroll.setViewportView(influencersPanel);
scroll.getVerticalScrollBar().setUnitIncrement(70);
}
}
propertiesPanel = new JPanel(new GridBagLayout());
rightSplitPane.add(propertiesPanel, JSplitPane.BOTTOM);
propertiesPanel.setBorder(new CompoundBorder(BorderFactory.createEmptyBorder(3, 0, 6, 6), BorderFactory.createTitledBorder("Particle Controller Components")));
{
JScrollPane scroll = new JScrollPane();
propertiesPanel.add(scroll, new GridBagConstraints(0, 0, 1, 1, 1, 1, GridBagConstraints.NORTH, GridBagConstraints.BOTH, new Insets(0, 0, 0, 0), 0, 0));
scroll.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 0));
{
controllerPropertiesPanel = new JPanel(new GridBagLayout());
scroll.setViewportView(controllerPropertiesPanel);
scroll.getVerticalScrollBar().setUnitIncrement(70);
}
}
}
rightSplit.setDividerLocation(250);
}
{
JSplitPane leftSplit = new JSplitPane(JSplitPane.VERTICAL_SPLIT);
leftSplit.setUI(new BasicSplitPaneUI() {
public void paint(Graphics g, JComponent jc) {
}
});
leftSplit.setDividerSize(4);
splitPane.add(leftSplit, JSplitPane.LEFT);
{
JPanel spacer = new JPanel(new BorderLayout());
leftSplit.add(spacer, JSplitPane.TOP);
spacer.add(lwjglCanvas.getCanvas());
spacer.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 4));
}
{
JPanel emittersPanel = new JPanel(new BorderLayout());
leftSplit.add(emittersPanel, JSplitPane.BOTTOM);
emittersPanel.setBorder(new CompoundBorder(BorderFactory.createEmptyBorder(0, 6, 6, 0), BorderFactory.createTitledBorder("Particle Controllers")));
{
effectPanel = new EffectPanel(this);
emittersPanel.add(effectPanel);
}
}
leftSplit.setDividerLocation(625);
}
splitPane.setDividerLocation(500);
}
use of javax.swing.plaf.basic.BasicSplitPaneUI in project jdk8u_jdk by JetBrains.
the class bug4885629 method main.
public static void main(String[] args) throws Exception {
UIManager.setLookAndFeel(new BasicLookAndFeel() {
public boolean isSupportedLookAndFeel() {
return true;
}
public boolean isNativeLookAndFeel() {
return false;
}
public String getDescription() {
return "Foo";
}
public String getID() {
return "FooID";
}
public String getName() {
return "FooName";
}
});
SwingUtilities.invokeAndWait(new Runnable() {
public void run() {
JFrame frame = new JFrame();
JComponent a = new JPanel();
a.setBackground(Color.white);
a.setMinimumSize(new Dimension(10, 10));
JComponent b = new JPanel();
b.setBackground(Color.white);
b.setMinimumSize(new Dimension(10, 10));
sp = new JSplitPane(JSplitPane.VERTICAL_SPLIT, a, b);
sp.setPreferredSize(new Dimension(20, 20));
sp.setBackground(BGCOLOR);
Border bo = new BasicBorders.SplitPaneBorder(lightHighlight, Color.red);
Border ibo = new EmptyBorder(0, 0, 0, 0);
sp.setBorder(bo);
sp.setMinimumSize(new Dimension(200, 200));
((BasicSplitPaneUI) sp.getUI()).getDivider().setBorder(ibo);
frame.getContentPane().setLayout(new FlowLayout());
frame.getContentPane().setBackground(darkShadow);
frame.getContentPane().add(sp);
frame.setSize(200, 200);
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
frame.setVisible(true);
}
});
((SunToolkit) SunToolkit.getDefaultToolkit()).realSync();
final Robot robot = new Robot();
robot.delay(1000);
SwingUtilities.invokeAndWait(new Runnable() {
public void run() {
Rectangle rect = ((BasicSplitPaneUI) sp.getUI()).getDivider().getBounds();
Point p = rect.getLocation();
SwingUtilities.convertPointToScreen(p, sp);
for (int i = 0; i < rect.width; i++) {
if (!BGCOLOR.equals(robot.getPixelColor(p.x + i, p.y + rect.height - 1))) {
throw new Error("The divider's area has incorrect color.");
}
}
}
});
}
use of javax.swing.plaf.basic.BasicSplitPaneUI in project pcgen by PCGen.
the class FlippingSplitPane method setupExtensions.
// private class KeyboardShiftHomeAction extends AbstractAction
// {
// public void actionPerformed(ActionEvent e)
// {
// centerDividerLocations();
// }
// }
// private class KeyboardShiftEndAction extends AbstractAction
// {
// public void actionPerformed(ActionEvent e)
// {
// resetToPreferredSizes();
// }
// }
/**
* {@code setupExtensions} installs the mouse listener for the popup menu,
* and fixes some egregious defaults in {@code JSplitPane}.
*/
private void setupExtensions() {
SplitPaneUI anUi = getUI();
if (anUi instanceof BasicSplitPaneUI) {
((BasicSplitPaneUI) anUi).getDivider().addMouseListener(new PopupListener());
}
// // See source for JSplitPane for this junk.
// ActionMap map = (ActionMap) UIManager.get("SplitPane.actionMap");
// map.put("selectCenter", new KeyboardShiftHomeAction()); // XXX
// map.put("selectReset", new KeyboardShiftEndAction()); // XXX
// SwingUtilities.replaceUIActionMap(this, map);
// This is *so* much better than squishing the top/left
// component into oblivion.
setResizeWeight(0.5);
}
use of javax.swing.plaf.basic.BasicSplitPaneUI in project pcgen by PCGen.
the class FlippingSplitPane method initComponent.
/**
* {@code initComponent} installs the mouse listener for the popup menu,
* and fixes some egregious defaults in {@code JSplitPane}.
*/
private void initComponent() {
SplitPaneUI anUi = getUI();
if (anUi instanceof BasicSplitPaneUI) {
((BasicSplitPaneUI) anUi).getDivider().addMouseListener(new PopupListener());
}
setResizeWeight(0.5);
baseContext = UIPropertyContext.createContext("dividerPrefs");
setInitialDividerLocation();
}
Aggregations