Ir para conteúdo

POWERED BY:

Arquivado

Este tópico foi arquivado e está fechado para novas respostas.

Pedroalves

problema no scroll panel

Recommended Posts

nãoi estou a conseguir por quando carrego para sima ou para baixo o contiudo do painel

o que tenho dentro Container

import com.jme3.app.Application;
    import com.jme3.app.SimpleApplication;
    import com.jme3.app.state.BaseAppState;
    import com.jme3.math.Vector3f;
    import com.jme3.renderer.ViewPort;
    import com.jme3.scene.Node;
    import com.overthemoon.core.inventory.panel.ViewportPanel;
    import com.overthemoon.core.inventory.panel.ViewportPanel2D;
    import com.simsilica.lemur.ActionButton;
    import com.simsilica.lemur.Axis;
    import com.simsilica.lemur.CallMethodAction;
    import com.simsilica.lemur.Container;
    import com.simsilica.lemur.DefaultRangedValueModel;
    import com.simsilica.lemur.FillMode;
    import com.simsilica.lemur.Insets3f;
    import com.simsilica.lemur.Label;
    import com.simsilica.lemur.Panel;
    import com.simsilica.lemur.PasswordField;
    import com.simsilica.lemur.Slider;
    import com.simsilica.lemur.TabbedPanel;
    import com.simsilica.lemur.TextField;
    import com.simsilica.lemur.component.BorderLayout;
    import com.simsilica.lemur.component.SpringGridLayout;
    import com.simsilica.lemur.core.GuiControl;
    import com.simsilica.lemur.style.ElementId;
    import com.simsilica.lemur.style.Styles;

    /**
     *
     * @author Pedro Alves
     */
    public class OptionsState  extends BaseAppState  {
        private Container loginPanel;
        private TextField nameField;
        private PasswordField passwordfield;
          private ViewPort  viewPort;
     protected void apply() {
            
           // String name = nameField.getText().trim();
          // String password= passwordfield.getText().trim();
           // if( getState(ConnectionState.class).joinserver(nameField.getText(),passwordfield.getText()) ) {
            //    getStateManager().detach(this);
            //}
        } 
      protected void join() {
            
           // String name = nameField.getText().trim();
          // String password= passwordfield.getText().trim();
           // if( getState(ConnectionState.class).joinserver(nameField.getText(),passwordfield.getText()) ) {
            //    getStateManager().detach(this);
            //}
        } 
     protected void cancel() {
         getStateManager().attach(new MainMenuState());
         getStateManager().detach(this); 
           // String name = nameField.getText().trim();
          // String password= passwordfield.getText().trim();
           // if( getState(ConnectionState.class).joinserver(nameField.getText(),passwordfield.getText()) ) {
            //    getStateManager().detach(this);
            //}
        } 
        public OptionsState() {
        
        }
        @Override
        protected void initialize(Application app) {
          loginPanel = new Container();
            loginPanel.addChild(new Label("Options", new ElementId("title")));
            
            Container props = loginPanel.addChild(new Container(new SpringGridLayout(Axis.Y, Axis.X, FillMode.None, FillMode.Last)));
            props.setBackground(null);    
            TabbedPanel tabs = new TabbedPanel();
            Panel panel1=new Panel(500,200);
            panel1.setInsets(new Insets3f(10, 10, 10, 10));
            ViewportPanel panel= new ViewportPanel(getStateManager(),panel1.getElementId(),panel1.getStyle());
    panel.attachScene(panel1);

    Container tab1 = tabs.addTab("Game Options", new Container());
    panel1=tab1.addChild(new Label("Game Options"));
    panel1=tab1.addChild(new Label("Game Options"));
    panel1=tab1.addChild(new Label("Game Options"));
    panel1=tab1.addChild(new Label("Game Options"));
    panel1=tab1.addChild(new Label("Game Options"));
    panel1=tab1.addChild(new Label("Game Options"));
    panel1=tab1.addChild(new Label("Game Options"));
    panel1=tab1.addChild(new Label("Game Options"));
    panel1=tab1.addChild(new Label("Game Options"));
    panel1=tab1.addChild(new Label("Game Options"));
    panel1=tab1.addChild(new Label("Game Options"));
    panel1=tab1.addChild(new Label("Game Options"));
    panel1=tab1.addChild(new Label("Game Options"));
    panel1=tab1.addChild(new Label("Game Options"));
    panel1=tab1.addChild(new Label("Game Options"));
    panel1=tab1.addChild(new Label("Game Options"));
    panel1=tab1.addChild(new Label("Game Options"));
    panel1=tab1.addChild(new Label("Game Options"));
    panel1=tab1.addChild(new Label("Game Options"));
    panel1=tab1.addChild(new Label("Game Options"));
    panel1=tab1.addChild(new Label("Game Options"));
    panel1=tab1.addChild(new Label("Game Options"));
    panel1=tab1.addChild(new Label("Game Options"));
    panel1=tab1.addChild(new Label("Game Options"));

    tab1.addChild(panel1);

    tab1.addChild(panel);
    Container tab2 = tabs.addTab("Graphic Options", new Container());
    tab2.addChild(new Label("Grapicos options"));
    Container tab3 = tabs.addTab(" Audio Options", new Container());
    tab3.addChild(new Label("Audio"));
    Container tab4 = tabs.addTab("Key Mapping ", new Container());
    tab4.addChild(new Label("Key Mapping"));
     loginPanel.addChild(tabs);

         Container buttons = loginPanel.addChild(new Container(new SpringGridLayout(Axis.X, Axis.Y)));
            buttons.setBackground(null);
            buttons.setLayout(new SpringGridLayout(Axis.X, Axis.Y));
           buttons.addChild(new ActionButton(new CallMethodAction("Default", this, "join"))); 
           buttons.addChild(new ActionButton(new CallMethodAction("Reset", this, "join")));
           buttons.addChild(new ActionButton(new CallMethodAction("Apply", this, "join"))); 
             buttons.addChild(new ActionButton(new CallMethodAction("OK", this, "join"))); 
             buttons.addChild(new ActionButton(new CallMethodAction("Cancel", this, "cancel"))); 
            float scale = 1.5f * getState(MainMenuState.class).getStandardScale();
            loginPanel.setLocalScale(scale);
            Vector3f prefs = loginPanel.getPreferredSize().clone();
            prefs.x = Math.max(300, prefs.x);
            loginPanel.setPreferredSize(prefs.clone());
            // Now account for scaling
            prefs.multLocal(scale);
            int width = app.getCamera().getWidth();
            int height = app.getCamera().getHeight();
            //loginPanel.setLocalTranslation(width * 0.5f - prefs.x * 0.5f, height * 0.5f + prefs.y * 0.5f, 10);       
        }

        @Override
        protected void cleanup(Application app) {
            
        }

        @Override
        protected void onEnable() {
            ViewportPanel2D viewportPanel = new ViewportPanel2D(getStateManager(), new ElementId(Container.ELEMENT_ID), Styles.ROOT_STYLE);
            viewportPanel.setPreferredSize(new Vector3f(600,400 , 1));
            int width = getApplication().getCamera().getWidth();
            int height = getApplication().getCamera().getHeight();
            viewportPanel.setLocalTranslation((width - 600) / 2, (height + 400) / 2, 100);
            BorderLayout layout = new BorderLayout();
            viewportPanel.getControl(GuiControl.class).setLayout(layout);
            Slider slider_V = new Slider(new DefaultRangedValueModel(), Axis.Y);
            layout.addChild(BorderLayout.Position.East, slider_V);
            
            Slider slider_H = new Slider(new DefaultRangedValueModel(), Axis.X);
            layout.addChild(BorderLayout.Position.South, slider_H);
            
            Node root = ((SimpleApplication)getApplication()).getGuiNode();
            root.attachChild(viewportPanel);
            viewportPanel.attachScene(loginPanel);
            
        }

        @Override
        protected void onDisable() {
            //throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
        loginPanel.removeFromParent();
        }
        
    }

 

Compartilhar este post


Link para o post
Compartilhar em outros sites

  • Conteúdo Similar

    • Por violin101
      Caros amigos, saudações.
       
      Estou escrevendo um Sistema Java Web e quando clico no Botão Salvar, o Java acusa esse erro:

      ERROR: Cannot invoke "Object.toString()" because the return value of "java.util.Map.get(Object)" is null
       
      Já tentei de várias formas resolver esse problema, mas não estou conseguindo.

      Por favor, alguém pode me ajudar identificar a origem e resolver o problema acima ?

      Grato,
       
      Cesar
    • Por violin101
      Caros amigos, saudações.

      Estou enfrentando um problema que não consigo entender.

      Após Instalar o MySql versão 8.0.36, funciona corretamente realizando as conexões.

      O problema é:
      ---[ após reiniciar o micro, o MySql não faz as conexões.
      --[ tenta localizar este arquivo, mas não acha: my.ini
       
      Onde localizo ou configuro este arquivo na Pasta MySql ?

      Grato,
       
      Cesar
    • Por violin101
      Caros amigos, saudações.
       
      Por favor, preciso de ajuda em Relação a Instalar o Jasper Reports no Eclipse, pois a opção de Eclipse Marketplace, não encontra para instalar.
       
      Já tentei de todas as formas mas não consegui, alguém conhece alguma rotina explicando este procedimento ?
       
      Grato,
       
      Cesar
    • Por violin101
      Caros amantes da informática.
       
      Saudações.
       
      Estou usando o Eclipse Mars versão 4.5.0  e o 4.5.2, acredito que deva ter versões mais novas. 
      Sou novato em JAVA e estou encontrando alguns problema em Instalação de alguns plugins, como por exemplo:
       
      1) quando tento instalar o JBoss Tools através do Eclipse Marteplace, o Eclipse não o encontra na lista de plugins.
      2) se tento instalar através do Install New Software, abaixa alguns arquivos, mas também não instala o JBoss.
      3) se abro o site e arrasto o download para a área de trabalho do Eclipse, também não instala o JBoss.
       
      Caros amigos, existe outra alguma forma de instalar o JBoss Tools no Eclipse e como seria ?
       
      Grato,
       
      Cesar
       
       
    • Por ILR master
      Pessoal, pergunta bem simples. Abaixo tenho o seguinte código:
       
      <script>
      function alerta()
      {
        if (window.confirm("Você realmente quer sair?")) {
          window.open("sair.html");
      }
      }
      </script>
       
      Funciona perfeitamente, só que está abrindo em outra janela e quero que abra na mesma janela.
       
      Alguém pode me ajudar?
×

Informação importante

Ao usar o fórum, você concorda com nossos Termos e condições.