From 25cef97465f0bfa8959663754e9243006324c81c Mon Sep 17 00:00:00 2001 From: Normand Briere <nbriere@noware.ca> Date: Wed, 01 May 2019 10:09:53 -0400 Subject: [PATCH] Nimbus L&F --- ObjEditor.java | 203 +++++++++++++++++++++++++++----------------------- 1 files changed, 109 insertions(+), 94 deletions(-) diff --git a/ObjEditor.java b/ObjEditor.java index 8a5cd39..98cec4e 100644 --- a/ObjEditor.java +++ b/ObjEditor.java @@ -138,34 +138,40 @@ public void closeUI() { //new Exception().printStackTrace(); - System.out.println("this = " + this); - System.out.println("objEditor = " + objEditor); +// System.out.println("this = " + this); +// System.out.println("objEditor = " + objEditor); //nameField.removeActionListener(this); - objEditor.ctrlPanel.remove(nameField); +// objEditor.ctrlPanel.remove(nameField); if (!GroupEditor.allparams) return; - objEditor.ctrlPanel.remove(liveCB); - objEditor.ctrlPanel.remove(hideCB); - objEditor.ctrlPanel.remove(markCB); - - objEditor.ctrlPanel.remove(randomCB); - objEditor.ctrlPanel.remove(speedupCB); - objEditor.ctrlPanel.remove(rewindCB); - - objEditor.ctrlPanel.remove(resetButton); - objEditor.ctrlPanel.remove(stepButton); -// objEditor.ctrlPanel.remove(stepAllButton); -// objEditor.ctrlPanel.remove(resetAllButton); - objEditor.ctrlPanel.remove(link2masterCB); - //objEditor.ctrlPanel.remove(flipVCB); - //objEditor.ctrlPanel.remove(texresMenu); - objEditor.ctrlPanel.remove(slowerButton); - objEditor.ctrlPanel.remove(fasterButton); - objEditor.ctrlPanel.remove(remarkButton); +// objEditor.ctrlPanel.remove(liveCB); +// objEditor.ctrlPanel.remove(hideCB); +// objEditor.ctrlPanel.remove(markCB); +// +// objEditor.ctrlPanel.remove(randomCB); +// objEditor.ctrlPanel.remove(speedupCB); +// objEditor.ctrlPanel.remove(rewindCB); +// +// objEditor.ctrlPanel.remove(resetButton); +// objEditor.ctrlPanel.remove(stepButton); +//// objEditor.ctrlPanel.remove(stepAllButton); +//// objEditor.ctrlPanel.remove(resetAllButton); +// objEditor.ctrlPanel.remove(link2masterCB); +// //objEditor.ctrlPanel.remove(flipVCB); +// //objEditor.ctrlPanel.remove(texresMenu); +// objEditor.ctrlPanel.remove(slowerButton); +// objEditor.ctrlPanel.remove(fasterButton); +// objEditor.ctrlPanel.remove(remarkButton); - Remove(normalpushField); + objEditor.ctrlPanel.remove(namePanel); + objEditor.ctrlPanel.remove(setupPanel); + objEditor.ctrlPanel.remove(commandsPanel); + objEditor.ctrlPanel.remove(pushPanel); + //objEditor.ctrlPanel.remove(fillPanel); + + //Remove(normalpushField); } public ObjEditor GetEditor() @@ -355,7 +361,7 @@ toolbarPanel.setName("Toolbar"); treePanel = new JPanel(); treePanel.setName("Tree"); - ctrlPanel = new cGridBag(); // new GridBagLayout()); + ctrlPanel = new cGridBag().setVertical(false); // new GridBagLayout()); ctrlPanel.setName("Edit"); materialPanel = new cGridBag().setVertical(true); materialPanel.setName("Material"); @@ -386,7 +392,7 @@ //mainPanel.setLayout(new GridBagLayout()); toolbarPanel.setLayout(new FlowLayout(FlowLayout.LEFT)); treePanel.setLayout(new GridBagLayout()); - ctrlPanel.setLayout(new GridBagLayout()); + //ctrlPanel.setLayout(new GridBagLayout()); //materialPanel.setLayout(new GridBagLayout()); aConstraints = new GridBagConstraints(0, 0, 1, 1, 1.0, 1.0, @@ -767,54 +773,44 @@ JButton slowerButton; JButton fasterButton; JButton remarkButton; + + cGridBag namePanel; + cGridBag setupPanel; + cGridBag commandsPanel; + cGridBag pushPanel; + cGridBag fillPanel; - JCheckBox AddCheckBox(ObjEditor oe, String label, boolean on) + JCheckBox AddCheckBox(cGridBag panel, String label, boolean on) { JCheckBox cb; - oe.aConstraints.fill = GridBagConstraints.HORIZONTAL; - oe.aConstraints.gridwidth = 1; // 3; -// oe.aConstraints.weightx = 1; -// oe.aConstraints.anchor = GridBagConstraints.WEST; - oe.ctrlPanel.add(cb = new JCheckBox(label, on), oe.aConstraints); //, oe.ctrlPanel.getComponentCount()-1); + panel.add(cb = new JCheckBox(label, on)); //, oe.aConstraints); //, oe.ctrlPanel.getComponentCount()-1); cb.addItemListener(this); -// oe.aConstraints.anchor = GridBagConstraints.EAST; - oe.aConstraints.gridwidth = 1; - oe.aConstraints.gridx += 1; return cb; } - cButton AddButton(ObjEditor oe, String label) + cButton AddButton(cGridBag panel, String label) { cButton cb; - oe.aConstraints.fill = GridBagConstraints.HORIZONTAL; - oe.aConstraints.gridwidth = 1; -// oe.aConstraints.weightx = 1; -// oe.aConstraints.anchor = GridBagConstraints.WEST; - oe.ctrlPanel.add(cb = new cButton(label), oe.aConstraints, oe.ctrlPanel.getComponentCount() - 1); + panel.add(cb = new cButton(label)); //, oe.aConstraints, oe.ctrlPanel.getComponentCount() - 1); cb.addActionListener(this); -// oe.aConstraints.anchor = GridBagConstraints.EAST; - oe.aConstraints.gridwidth = 1; - oe.aConstraints.gridx += 1; return cb; } - JComboBox AddCombo(ObjEditor oe, java.util.Vector list, int item) + JComboBox AddCombo(cGridBag panel, java.util.Vector list, int item) { JComboBox combo; - oe.aConstraints.fill = GridBagConstraints.HORIZONTAL; - oe.ctrlPanel.add(combo = new JComboBox(new cListModel(list, item)), oe.aConstraints); //, oe.ctrlPanel.getComponentCount()-1); - oe.aConstraints.gridx += 1; + panel.add(combo = new JComboBox(new cListModel(list, item))); //, oe.aConstraints); //, oe.ctrlPanel.getComponentCount()-1); combo.addActionListener(this); return combo; } - cNumberSlider AddSlider(cGridBag ctrlPanel, String label, double min, double max, double current, double pow) + cGridBag AddSlider(cGridBag panel, String label, double min, double max, double current, double pow) { cGridBag control = new cGridBag(); @@ -826,12 +822,12 @@ control.add(combo = new cNumberSlider(this, min, max, pow)); //, aConstraints); //, oe.ctrlPanel.getComponentCount()-1); combo.setFloat(current); - ctrlPanel.add(control); + panel.add(control); - return combo; + return control; } - cNumberSlider AddSlider(cGridBag ctrlPanel, String label, int min, int max, int current) + cGridBag AddSlider(cGridBag panel, String label, int min, int max, int current) { cGridBag control = new cGridBag(); @@ -839,25 +835,21 @@ JLabel jlabel = new JLabel(label); jlabel.setHorizontalAlignment(SwingConstants.TRAILING); - ctrlPanel.add(jlabel); //, aConstraints); //, oe.ctrlPanel.getComponentCount()-1); - ctrlPanel.add(combo = new cNumberSlider(this, min, max)); //, aConstraints); //, oe.ctrlPanel.getComponentCount()-1); + control.add(jlabel); //, aConstraints); //, oe.ctrlPanel.getComponentCount()-1); + control.add(combo = new cNumberSlider(this, min, max)); //, aConstraints); //, oe.ctrlPanel.getComponentCount()-1); combo.setInteger(current); - ctrlPanel.add(control); + panel.add(control); - return combo; + return control; } JTextArea AddText(cGridBag ctrlPanel, String name) { JTextArea text; - aConstraints.fill = GridBagConstraints.HORIZONTAL; - aConstraints.gridwidth = ObjEditor.GRIDWIDTH; ctrlPanel.add(text = new JTextArea(name)); //, aConstraints); //, oe.ctrlPanel.getComponentCount()-1); text.addCaretListener(this); - aConstraints.gridx += 1; - aConstraints.gridwidth = 1; return text; } @@ -896,7 +888,7 @@ /* */ - void Return() // ObjEditor oe) + void Return0() // ObjEditor oe) { aConstraints.gridy += 1; aConstraints.gridx = 0; @@ -955,33 +947,52 @@ // oe.aConstraints.weighty = 0; // oe.aConstraints.gridx = 0; // oe.aConstraints.gridy = 0; - SetupName(oe); + //SetupName(oe); + + namePanel = new cGridBag(); + + nameField = AddText(namePanel, copy.GetName()); + namePanel.add(nameField); + oe.ctrlPanel.add(namePanel); + + oe.ctrlPanel.Return(); if (!GroupEditor.allparams) return; - liveCB = AddCheckBox(oe, "Live", copy.live); - link2masterCB = AddCheckBox(oe, "Supp", copy.link2master); - hideCB = AddCheckBox(oe, "Hide", copy.hide); + setupPanel = new cGridBag().setVertical(false); + + liveCB = AddCheckBox(setupPanel, "Live", copy.live); + link2masterCB = AddCheckBox(setupPanel, "Supp", copy.link2master); + hideCB = AddCheckBox(setupPanel, "Hide", copy.hide); // Return(); - markCB = AddCheckBox(oe, "Mark", copy.marked); - rewindCB = AddCheckBox(oe, "Rew", copy.rewind); - randomCB = AddCheckBox(oe, "Rand", copy.random); - Return(); - resetButton = AddButton(oe, "Reset"); - stepButton = AddButton(oe, "Step"); + markCB = AddCheckBox(setupPanel, "Mark", copy.marked); + rewindCB = AddCheckBox(setupPanel, "Rew", copy.rewind); + randomCB = AddCheckBox(setupPanel, "Rand", copy.random); + + oe.ctrlPanel.add(setupPanel); + oe.ctrlPanel.Return(); + + commandsPanel = new cGridBag().setVertical(false); + + resetButton = AddButton(commandsPanel, "Reset"); + stepButton = AddButton(commandsPanel, "Step"); // resetAllButton = AddButton(oe, "Reset All"); // stepAllButton = AddButton(oe, "Step All"); - speedupCB = AddCheckBox(oe, "Speed", copy.speedup); + speedupCB = AddCheckBox(commandsPanel, "Speed", copy.speedup); // Return(); - slowerButton = AddButton(oe, "Slow"); - fasterButton = AddButton(oe, "Fast"); - remarkButton = AddButton(oe, "Rem"); + slowerButton = AddButton(commandsPanel, "Slow"); + fasterButton = AddButton(commandsPanel, "Fast"); + remarkButton = AddButton(commandsPanel, "Remark"); - //Return(); + oe.ctrlPanel.add(commandsPanel); + oe.ctrlPanel.Return(); - //normalpushField = AddSlider(oe.ctrlPanel, "Push", -10, 10, 0, -1); + pushPanel = AddSlider(oe.ctrlPanel, "Push", -10, 10, 0, 1); + normalpushField = (cNumberSlider)pushPanel.getComponent(1); //Return(); + + oe.ctrlPanel.Return(); // oe.ctrlPanel.add(stepButton = new cButton("Step"), ObjEditor.aConstraints, oe.ctrlPanel.getComponentCount() - 2); // ObjEditor.aConstraints.gridx += 1; @@ -1076,7 +1087,7 @@ oe.aConstraints.gridwidth = 1; /**/ nameField = AddText(oe.ctrlPanel, copy.GetName()); - Return(); + oe.ctrlPanel.Return(); //ctrlPanel.add(textureButton = new Button("Texture...")); //textureButton.setEnabled(false); @@ -1253,10 +1264,11 @@ //JScrollPane tmp = new JScrollPane(ctrlPanel, ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED, ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER); //tmp.setName("Edit"); objectPanel.add(materialPanel); - JPanel north = new JPanel(new BorderLayout()); - north.setName("Edit"); - north.add(ctrlPanel, BorderLayout.NORTH); - objectPanel.add(north); +// JPanel north = new JPanel(new BorderLayout()); +// north.setName("Edit"); +// north.add(ctrlPanel, BorderLayout.NORTH); +// objectPanel.add(north); + objectPanel.add(ctrlPanel); objectPanel.add(infoPanel); /* @@ -1415,7 +1427,7 @@ ctrlPanel.removeAll(); } - void SetupMaterial(cGridBag ctrlPanel) + void SetupMaterial(cGridBag panel) { /* ctrlPanel.add(materialLabel = new JLabel("MATERIAL : "), aConstraints); @@ -1435,7 +1447,7 @@ editBar.add(propagateToggle = new cCheckBox("Prop", propagate)); // , aConstraints); editBar.add(multiplyToggle = new cCheckBox("Mult", false)); // , aConstraints); - ctrlPanel.add(editBar); + panel.add(editBar); /**/ //aConstraints.weighty = 0; @@ -1484,9 +1496,9 @@ shadowbias.add(shadowbiasField = new cNumberSlider(this, 0.001, 50, -1)); // , aConstraints); colorSection.add(shadowbias); - ctrlPanel.add(new JSeparator()); + panel.add(new JSeparator()); - ctrlPanel.add(colorSection); + panel.add(colorSection); //ctrlPanel.add(new JLabel("----------------------------------")); // , aConstraints); @@ -1534,9 +1546,9 @@ fakedepth.add(fakedepthField = new cNumberSlider(this, 0.001, 50, -1)); // , aConstraints); diffuseSection.add(fakedepth); - ctrlPanel.add(new JSeparator()); + panel.add(new JSeparator()); - ctrlPanel.add(diffuseSection); + panel.add(diffuseSection); //ctrlPanel.add(new JLabel("----------------------------------")); // , aConstraints); @@ -1572,7 +1584,7 @@ velvet.add(velvetField = new cNumberSlider(this, 0.001, 50, -1)); // , aConstraints); specularSection.add(velvet); - shiftField = AddSlider(specularSection, "Shift", 0.001, 50, copy.material.shift, -1); + shiftField = (cNumberSlider)AddSlider(specularSection, "Shift", 0.001, 50, copy.material.shift, -1).getComponent(1); //Return(); // ctrlPanel.add(shiftLabel = new JLabel("Shift"), aConstraints); // shiftLabel.setHorizontalAlignment(SwingConstants.TRAILING); @@ -1585,9 +1597,9 @@ // aConstraints.gridwidth = 1; - ctrlPanel.add(new JSeparator()); + panel.add(new JSeparator()); - ctrlPanel.add(specularSection); + panel.add(specularSection); //ctrlPanel.add(new JLabel("----------------------------------")); // , aConstraints); @@ -1617,9 +1629,9 @@ opacity.add(opacityField = new cNumberSlider(this, 0.001, 1, -0.5)); // , aConstraints); globalSection.add(opacity); - ctrlPanel.add(new JSeparator()); + panel.add(new JSeparator()); - ctrlPanel.add(globalSection); + panel.add(globalSection); //ctrlPanel.add(new JLabel("----------------------------------")); // , aConstraints); @@ -1661,9 +1673,9 @@ opacityPower.add(opacityPowerField = new cNumberSlider(this, 0.0, 10 /*10 dec 2013*/)); // , aConstraints); textureSection.add(opacityPower); - ctrlPanel.add(new JSeparator()); + panel.add(new JSeparator()); - ctrlPanel.add(textureSection); + panel.add(textureSection); //ctrlPanel.add(new JLabel("----------------------------------")); // , aConstraints); @@ -2482,6 +2494,7 @@ } if (input == null) { + new Exception().printStackTrace(); System.exit(0); } @@ -3211,6 +3224,7 @@ callee.refreshContents(); } else { + new Exception().printStackTrace(); System.exit(0); } } @@ -3421,6 +3435,7 @@ || e.getSource() == apertureField || e.getSource() == shadowblurField) { + new Exception().printStackTrace(); System.exit(0); cameraView.options1[0] = (float) focusField.getFloat() * 10; cameraView.options1[1] = (float) apertureField.getFloat() / 1000; @@ -4392,8 +4407,8 @@ //MenuItem normalLensItem; MenuItem editCameraItem; MenuItem revertCameraItem; - CheckboxMenuItem toggleLiveItem; MenuItem stepItem; + CheckboxMenuItem toggleLiveItem; CheckboxMenuItem toggleFullScreenItem; CheckboxMenuItem toggleTimelineItem; CheckboxMenuItem toggleRenderItem; -- Gitblit v1.6.2