|
From: <tre...@us...> - 2007-09-18 22:45:27
|
Revision: 423
http://ogoglio.svn.sourceforge.net/ogoglio/?rev=423&view=rev
Author: trevorolio
Date: 2007-09-18 15:45:25 -0700 (Tue, 18 Sep 2007)
Log Message:
-----------
Now you can select your height from the body editor applet.
Modified Paths:
--------------
maven/trunk/ogoglio-body-editor-applet/src/main/java/com/ogoglio/bodyeditor/BodyEditorApplet.java
Added Paths:
-----------
maven/trunk/ogoglio-body-editor-applet/src/main/resources/images/FemaleIcon32x32.gif
maven/trunk/ogoglio-body-editor-applet/src/main/resources/images/MaleIcon32x32.gif
Modified: maven/trunk/ogoglio-body-editor-applet/src/main/java/com/ogoglio/bodyeditor/BodyEditorApplet.java
===================================================================
--- maven/trunk/ogoglio-body-editor-applet/src/main/java/com/ogoglio/bodyeditor/BodyEditorApplet.java 2007-09-18 17:43:02 UTC (rev 422)
+++ maven/trunk/ogoglio-body-editor-applet/src/main/java/com/ogoglio/bodyeditor/BodyEditorApplet.java 2007-09-18 22:45:25 UTC (rev 423)
@@ -49,7 +49,11 @@
import javax.swing.ImageIcon;
import javax.swing.JButton;
import javax.swing.JLabel;
+import javax.swing.JPanel;
import javax.swing.JRadioButton;
+import javax.swing.JSlider;
+import javax.swing.event.ChangeEvent;
+import javax.swing.event.ChangeListener;
import javax.vecmath.Color3f;
import javax.vecmath.Point3d;
import javax.vecmath.Vector3f;
@@ -117,7 +121,7 @@
public BodyEditorApplet() {
setBackground(Color.WHITE);
setLayout(new BorderLayout());
- setSize(new Dimension(500, 500));
+ setSize(new Dimension(800, 600));
}
private class SpacelessUser extends User {
@@ -174,7 +178,7 @@
}
private class BodyPanel extends Panel {
- Dimension dimension = new Dimension(200, 300);
+ Dimension dimension = new Dimension(300, 400);
private J3DUniverse universe = null;
@@ -249,8 +253,8 @@
canvas.getView().setTransparencySortingPolicy(View.TRANSPARENCY_SORT_GEOMETRY);
canvas.getView().setSceneAntialiasingEnable(true);
- camera.setRotation(-0.5, Math.PI, 0);
- camera.setLocation(new Vector3f(0f, 1.8f, -1.2f));
+ camera.setRotation(-0.2, Math.PI, 0);
+ camera.setLocation(new Vector3f(0f, 1.7f, -2.5f));
sceneRoot.addChild(camera.getNode());
universe.makeLive();
@@ -270,10 +274,10 @@
ScrollingRowPanel faceRow = new ScrollingRowPanel(true, faceRowModel);
+ GenderPanel genderPanel = new GenderPanel();
+
HeightPanel heightPanel = new HeightPanel();
- GenderPanel genderPanel = new GenderPanel();
-
public WestPanel() {
setPreferredSize(dimension);
setMinimumSize(dimension);
@@ -281,12 +285,13 @@
setBackground(Color.WHITE);
//add(hairRow);
- add(eyesRow);
- add(noseRow);
- add(mouseRow);
- add(faceRow);
+ //add(eyesRow);
+ //add(noseRow);
+ //add(mouseRow);
+ //add(faceRow);
add(genderPanel);
- //add(heightPanel);
+ add(heightPanel);
+
}
}
@@ -304,16 +309,19 @@
} catch (IOException e) {
e.printStackTrace();
}
-
}
private class GenderPanel extends Panel implements ActionListener {
- Dimension dimension = new Dimension(80, 55);
+ Dimension dimension = new Dimension(80, 100);
- JRadioButton maleButton = new JRadioButton("male");
+ ImageIcon maleIcon = UIConstants.loadIconFromResource("images/MaleIcon32x32.gif");
- JRadioButton femaleButton = new JRadioButton("female");
+ ImageIcon femaleIcon = UIConstants.loadIconFromResource("images/FemaleIcon32x32.gif");
+ JRadioButton maleButton = new JRadioButton("male", maleIcon);
+
+ JRadioButton femaleButton = new JRadioButton("female", femaleIcon);
+
public GenderPanel() {
setPreferredSize(dimension);
setMinimumSize(dimension);
@@ -354,15 +362,50 @@
}
}
- private class HeightPanel extends Panel {
- Dimension dimension = new Dimension(150, 25);
+ private class HeightPanel extends Panel implements ChangeListener {
+ Dimension dimension = new Dimension(150, 150);
+ JSlider slider = new JSlider(JSlider.VERTICAL, 150, 210, 200);
public HeightPanel() {
+
setPreferredSize(dimension);
setMinimumSize(dimension);
+ setLayout(new BorderLayout());
+ setBackground(Color.WHITE);
- setBackground(Color.GRAY);
+
+ JLabel heightLabel = new JLabel("height:");
+ heightLabel.setBackground(Color.WHITE);
+ JPanel panel = new JPanel(new FlowLayout(FlowLayout.CENTER));
+ panel.setBackground(Color.WHITE);
+ panel.add(heightLabel);
+ add(panel, BorderLayout.NORTH);
+
+ int value = (int)(user.getBody().getHeight() * 100);
+ slider.setValue(value);
+ slider.addChangeListener(this);
+ slider.setMajorTickSpacing(20);
+ slider.setPaintTicks(true);
+ slider.setPaintLabels(true);
+ add(slider, BorderLayout.CENTER);
}
+
+ public void stateChanged(ChangeEvent event) {
+ if (slider.getModel().getValueIsAdjusting()) {
+ return;
+ }
+ float newHeight = slider.getValue() / 100f;
+ if (user.getBody().getHeight() != newHeight) {
+ user.getBody().setHeight(newHeight);
+ bodyPanel.renderable.setHeight(newHeight);
+ try {
+ bodyDoc.setHeight(newHeight);
+ webClient.updateBody(bodyDoc);
+ } catch (IOException e) {
+ e.printStackTrace();
+ }
+ }
+ }
}
private class WidthPanel extends Panel {
@@ -381,7 +424,7 @@
JButton[] animationButtons = null;
- AnimationPanel(){
+ AnimationPanel() {
setPreferredSize(dimension);
setMinimumSize(dimension);
setBackground(Color.WHITE);
@@ -392,12 +435,12 @@
animationButtons[i].addActionListener(this);
add(animationButtons[i]);
}
-
+
}
public void actionPerformed(ActionEvent event) {
for (int i = 0; i < animationButtons.length; i++) {
- if(event.getSource() == animationButtons[i]){
+ if (event.getSource() == animationButtons[i]) {
playAnimation(animationButtons[i].getText());
break;
}
@@ -405,9 +448,9 @@
}
}
- private void playAnimation(String command){
+ private void playAnimation(String command) {
for (int i = 0; i < BodyConstants.USER_ANIMATION_COMMANDS.length; i++) {
- if(BodyConstants.USER_ANIMATION_COMMANDS[i].equals(command)){
+ if (BodyConstants.USER_ANIMATION_COMMANDS[i].equals(command)) {
try {
Bvh bvh = new BvhParser(user, i).parse();
bodyPanel.renderable.playAnimation(bvh, false);
@@ -420,7 +463,7 @@
}
}
}
-
+
private class EastPanel extends Panel {
Dimension dimension = new Dimension(150, 300);
@@ -439,7 +482,7 @@
WidthPanel widthPanel = new WidthPanel();
AnimationPanel animationPanel = new AnimationPanel();
-
+
public EastPanel() {
setPreferredSize(dimension);
setMinimumSize(dimension);
@@ -447,11 +490,11 @@
setBackground(Color.WHITE);
//add(hairRow);
- add(eyesRow);
- add(noseRow);
- add(mouthRow);
- add(faceRow);
-
+ //add(eyesRow);
+ //add(noseRow);
+ //add(mouthRow);
+ //add(faceRow);
+
add(animationPanel);
//add(texturePanel);
//add(widthPanel);
@@ -737,9 +780,9 @@
configTemplate.setDoubleBuffer(GraphicsConfigTemplate.REQUIRED);
return device.getBestConfiguration(configTemplate);
}
-
+
public boolean completedInitialLoad() {
- return completedInitialLoad ;
+ return completedInitialLoad;
}
}
Added: maven/trunk/ogoglio-body-editor-applet/src/main/resources/images/FemaleIcon32x32.gif
===================================================================
(Binary files differ)
Property changes on: maven/trunk/ogoglio-body-editor-applet/src/main/resources/images/FemaleIcon32x32.gif
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: maven/trunk/ogoglio-body-editor-applet/src/main/resources/images/MaleIcon32x32.gif
===================================================================
(Binary files differ)
Property changes on: maven/trunk/ogoglio-body-editor-applet/src/main/resources/images/MaleIcon32x32.gif
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|