Example usage for com.jgoodies.looks.plastic PlasticLookAndFeel set3DEnabled

List of usage examples for com.jgoodies.looks.plastic PlasticLookAndFeel set3DEnabled

Introduction

In this page you can find the example usage for com.jgoodies.looks.plastic PlasticLookAndFeel set3DEnabled.

Prototype

public static void set3DEnabled(boolean b) 

Source Link

Usage

From source file:com.angrysnail.sheeta.svgeditor.Editor.java

License:LGPL

/**
 * The constructor of the class/*from w ww  .  j a va  2 s . co m*/
 */
public Editor() {

    try {
        PlasticXPLookAndFeel laf = new PlasticXPLookAndFeel();
        PlasticLookAndFeel.set3DEnabled(true);
        UIManager.setLookAndFeel(laf);
    } catch (Exception e) {
    }

    editor = this;
}

From source file:com.prodp.apsim.APProcessHandler.java

License:Apache License

/**
 * //ww w .ja  v a  2  s.com
 * Sets up the whole game.
 * 
 * Sets up things like the GUI, put through {@link APGUI}, the scene
 * objects, and other things in {@link APFinalData}.
 * 
 * @throws AWTException
 * @throws ClassNotFoundException
 * @throws InstantiationException
 * @throws IllegalAccessException
 * @throws UnsupportedLookAndFeelException
 * @throws CloneNotSupportedException
 */

public void init() throws AWTException, ClassNotFoundException, InstantiationException, IllegalAccessException,
        UnsupportedLookAndFeelException, CloneNotSupportedException {

    // Get the icon
    try {
        APFinalData.apIconImage = new ImageIcon(
                ImageIO.read(new APMain().getClass().getResource("icons/apsim.png"))).getImage();
    } catch (IOException e) {
        e.printStackTrace();
    }

    // For mouse control and screenshots
    center = new Robot();

    // Set Graphics
    graphics.setSceneAntialiasing(GraphicsConfigTemplate.PREFERRED);
    graphics.setDoubleBuffer(GraphicsConfigTemplate.PREFERRED);
    graphicsConfig = GraphicsEnvironment.getLocalGraphicsEnvironment().getDefaultScreenDevice()
            .getBestConfiguration(graphics);
    c3d = new APRenderer(graphicsConfig, (JComponent) APFinalData.mainFrame.getContentPane());
    c3d.setVisible(true);

    // setLookAndFeel
    PlasticLookAndFeel.set3DEnabled(true);
    PlasticLookAndFeel.setTabStyle(Plastic3DLookAndFeel.TAB_STYLE_METAL_VALUE);
    PlasticLookAndFeel.setPlasticTheme(new DesertBluer());

    UIManager.setLookAndFeel(new PlasticLookAndFeel());

    Options.setPopupDropShadowEnabled(true);
    Options.setUseNarrowButtons(true);

    // This is the Processor initialization
    final APProcess firstProcess = new APProcess("Untitled" + untitled + ".aps");
    APList.addProcess(firstProcess);

    APProcess process = APList.getCurrentProcess();

    // The default position
    mainRoutineFinalTransform.setTranslation(new Vector3f(0, 0, 0));

    // Set up the grass
    Transform3D grass3d = new Transform3D();
    grass3d.setScale(50);

    TextureAttributes ta = new TextureAttributes();
    ta.setTextureMode(TextureAttributes.MODULATE);
    ta.setPerspectiveCorrectionMode(TextureAttributes.FASTEST);
    ta.setTextureTransform(grass3d);

    Appearance floorapp = new Appearance();
    floorapp.setTexture(
            new TextureLoader(new APRandImage(1024, 1024, BufferedImage.TYPE_3BYTE_BGR, new Color(111, 71, 40),
                    new Color(50, 30, 7), new Color(104, 57, 23), new Color(22, 12, 6)), "RGB", null)
                            .getTexture());
    floorapp.setTextureAttributes(ta);

    // Referencing the position of the floor to floorcoord
    APFinalData.floor.setCoordRefFloat(APFinalData.floorcoord);
    APFinalData.floor.setTexCoordRefFloat(0, APFinalData.floortex);

    // Hide the cursor
    c3d.setCursor(APFinalData.transparentCursor);

    // Main geometry array
    cMain = new QuadArray(APFinalData.LIMIT * 24, QuadArray.COORDINATES | QuadArray.COLOR_4
            | QuadArray.BY_REFERENCE | QuadArray.TEXTURE_COORDINATE_2);

    // Wind geometry array
    windLoc = new LineArray(2 * APFinalData.PRESSURE_COUNT,
            LineArray.COORDINATES | LineArray.COLOR_3 | LineArray.BY_REFERENCE);

    // Dynamic positioning
    cMain.setCapability(GeometryArray.ALLOW_REF_DATA_READ);
    cMain.setCapability(GeometryArray.ALLOW_REF_DATA_WRITE);

    windLoc.setCapability(GeometryArray.ALLOW_REF_DATA_READ);
    windLoc.setCapability(GeometryArray.ALLOW_REF_DATA_WRITE);

    // Set the reference of the geometry array to the coordinates and the
    // colors
    cMain.setCoordRefFloat(process.coords);
    cMain.setColorRefByte(process.colors);
    cMain.setTexCoordRefFloat(0, process.texturecoords);

    windLoc.setCoordRefFloat(process.windcoords);
    windLoc.setColorRefByte(process.windcolors);

    // Now add the reactionary components

    APRList.addReaction(new APReaction(new APPair(APMaterial.WOOD.getID(), APMaterial.LAVA.getID()),
            APMaterial.FIRE, 0.2f, APFinalData.CHANGE_BLOCK_FLAG));
    APRList.addReaction(new APReaction(new APPair(APMaterial.WOOD.getID(), APMaterial.FIRE.getID()),
            APMaterial.FIRE, 0.1f, APFinalData.CHANGE_BLOCK_FLAG));
    APRList.addReaction(new APReaction(new APPair(APMaterial.STONE.getID(), APMaterial.LAVA.getID()),
            APMaterial.LAVA, 0.1f, APFinalData.CHANGE_BLOCK_FLAG));
    APRList.addReaction(new APReaction(new APPair(APMaterial.WATER.getID(), APMaterial.LAVA.getID()),
            APMaterial.STEAM, 0.4f, APFinalData.CHANGE_BLOCK_FLAG));
    APRList.addReaction(new APReaction(new APPair(APMaterial.LAVA.getID(), APMaterial.WATER.getID()),
            APMaterial.STONE, 0.9f, APFinalData.CHANGE_BLOCK_FLAG));
    APRList.addReaction(new APReaction(new APPair(APMaterial.FIRE.getID(), APMaterial.WATER.getID()),
            APMaterial.NULL, 0.9f, APFinalData.REMOVE_BLOCK_FLAG));
    APRList.addReaction(new APReaction(new APPair(APMaterial.WATER.getID(), APMaterial.ICE.getID()),
            APMaterial.ICE, 0.01f, APFinalData.CHANGE_BLOCK_FLAG));
    APRList.addReaction(new APReaction(new APPair(APMaterial.ICE.getID(), APMaterial.LAVA.getID()),
            APMaterial.WATER, 1, APFinalData.CHANGE_BLOCK_FLAG));

    APFinalData.mainFrame.init();

    // Set the canvas size
    c3d.setPreferredSize(new Dimension(550, 300));
    c3d.setLocation(0, 0);

    // Don't let the geometry clip off
    final Appearance polyAppearance = new Appearance();
    polyAppearance.setPolygonAttributes(
            new PolygonAttributes(PolygonAttributes.POLYGON_FILL, PolygonAttributes.CULL_NONE, 0));
    polyAppearance.setTextureAttributes(new TextureAttributes());
    polyAppearance.setTexture(APFinalData.textures);

    final Appearance lineAppearance = new Appearance();
    lineAppearance.setLineAttributes(new LineAttributes(1, LineAttributes.PATTERN_SOLID, false));

    TransparencyAttributes trans = new TransparencyAttributes();
    trans.setTransparencyMode(TransparencyAttributes.BLENDED);
    polyAppearance.setTransparencyAttributes(trans);

    // Add the GeometryArray to the Shape3D
    aobjects.addGeometry(cMain);
    aobjects.setAppearance(polyAppearance);

    lobjects.addGeometry(windLoc);
    lobjects.setAppearance(lineAppearance);

    ground.addGeometry(APFinalData.floor);
    ground.setAppearance(floorapp);

    // Initialize the AmbientLight
    APFinalData.whiteLight.setInfluencingBounds(bounds);

    // Sky
    Background back = new Background();
    back.setApplicationBounds(new BoundingSphere(new Point3d(0, 0, 0), 1));

    skyTG.setCapability(TransformGroup.ALLOW_TRANSFORM_WRITE);

    skyTrans.rotX(0);
    skyTG.setTransform(skyTrans);
    skyTG.addChild(sky);

    BranchGroup backgeom = new BranchGroup();
    backgeom.addChild(skyTG);

    back.setGeometry(backgeom);

    // Add the brush
    selection.setCapability(QuadArray.ALLOW_REF_DATA_WRITE);
    selections.addGeometry(selection);
    selections.setAppearance(APFinalData.wireframe);

    APFinalData.brushes.addChild(selections);

    // Scene initialization
    scene = new APSceneGraph(c3d);
    scene.addChild(APFinalData.whiteLight, aobjects, lobjects, ground, back, APFinalData.brushes);

    // Add it to the world
    scene.addBranchGraph();

    // Prepare the world
    scene.prepare(mainRoutineFinalTransform);

    // Make the Canvas draw right
    c3d.setDoubleBufferEnable(true);

    // Stereo Red-blue
    c3d.getView().getPhysicalBody().setLeftEyePosition(new Point3d(-0.01, 0, 0));
    c3d.getView().getPhysicalBody().setRightEyePosition(new Point3d(0.01, 0, 0));
    c3d.getView().setDepthBufferFreezeTransparent(false);

    // Note: c3d has no anaglyphs
    c3d.setStereoMode(StereoMode.OFF);

    // Add Canvas listeners
    c3d.addMouseListener(this);
    c3d.addMouseMotionListener(this);
    c3d.addKeyListener(this);

    // Add menubar listeners
    APFinalData.Exit.addActionListener(this);
    APFinalData.New.addActionListener(this);
    APFinalData.Open.addActionListener(this);
    APFinalData.Save.addActionListener(this);
    APFinalData.Save_As.addActionListener(this);
    APFinalData.Import.addActionListener(this);
    APFinalData.Export.addActionListener(this);
    APFinalData.Element.addActionListener(this);
    APFinalData.Exit.addActionListener(this);
    APFinalData.Join_Server.addActionListener(this);
    APFinalData.Create_Server.addActionListener(this);
    APFinalData.View_Options.addActionListener(this);
    APFinalData.Sound.addActionListener(this);
    APFinalData.Online_Help.addActionListener(this);
    APFinalData.About_Us.addActionListener(this);
    APFinalData.Update.addActionListener(this);
    APFinalData.View_Ok.addActionListener(this);
    APFinalData.View_Cancel.addActionListener(this);
    APFinalData.Element_Ok.addActionListener(this);
    APFinalData.Element_Cancel.addActionListener(this);
    APFinalData.antiaDisable.addActionListener(this);
    APFinalData.antiaEnable.addActionListener(this);
    APFinalData.anaglyphFull.addActionListener(this);
    APFinalData.anaglyphGray.addActionListener(this);
    APFinalData.anaglyphHalf.addActionListener(this);
    APFinalData.anaglyphNone.addActionListener(this);
    APFinalData.anaglyphOptim.addActionListener(this);
    APFinalData.anaglyphRedBlue.addActionListener(this);
    APFinalData.anaglyphRedGreen.addActionListener(this);
    APFinalData.senseSlider.addChangeListener(this);
    APFinalData.elementChooser.addActionListener(this);
    APFinalData.SprayVacuum.addActionListener(this);
    APFinalData.Wind.addActionListener(this);

    APFinalData.processSwitch.setBackground(Color.WHITE);
    APFinalData.processSwitch.addChangeListener(this);
    APFinalData.processSwitch.setTabLayoutPolicy(JTabbedPane.SCROLL_TAB_LAYOUT);

    // APFinalData.mainFrame.setVisible(true);

    // Make the thread
    if (threedanim == null)
        threedanim = new Thread(new APMain(), "APThread");

    // Make it the best thread
    threedanim.setPriority(APSceneGraph.getJ3DThreadPriority());
    threedanim.setDaemon(false);
    threedanim.start();

    // Make it live
    isRunning = true;

    APFinalData.mainFrame.setVisible(true);
}

From source file:org.springframework.richclient.application.config.JGoodiesLooksConfigurer.java

License:Apache License

/**
 * @param threeDEnabled set to <code>true</code> if 3D should be enabled.
 * @see com.jgoodies.looks.plastic.PlasticLookAndFeel#set3DEnabled(boolean)
 *//*from   w w  w  .  j ava  2 s .  c o m*/
public void set3DEnabled(boolean threeDEnabled) {
    PlasticLookAndFeel.set3DEnabled(threeDEnabled);
}

From source file:org.tentackle.plaf.tlooks.TLooksLookAndFeel.java

License:Open Source License

public void configureTLooksLookAndFeel() {
    PlasticLookAndFeel.setTabStyle(PlasticLookAndFeel.TAB_STYLE_METAL_VALUE);
    PlasticLookAndFeel.set3DEnabled(true);
    Options.setPopupDropShadowEnabled(true);
    UIManager.put(Options.PLASTIC_MICRO_LAYOUT_POLICY_KEY, TLooksMicroLayoutPolicies.getDefaultPlasticPolicy());
}