Examples of KPanel


Examples of com.amazon.kindle.kindlet.ui.KPanel

      if (commands.size() == 1) {
        execute((Command) commands.get(0));
        return;
      }

      KPanel btnPanel = new KPanel();
      GridLayout layout = new GridLayout(commands.size(), 1);
      layout.setVgap(2);
      btnPanel.setLayout(layout);

      for (int i = 0; i < commands.size(); i++) {
        Command command = (Command) commands.get(i);
        final KButton btn = new KButton(command.getDescription());
        btn.setFont(new Font(btn.getFont().getName(), Font.BOLD, btn.getFont().getSize() + 6));
        command.setExecuter(this);
        btn.addKeyListener(command);
        // flash button
        btn.addKeyListener(new KeyListener() {
          public void keyTyped(KeyEvent e) {
          }

          public void keyPressed(KeyEvent e) {
            btn.setBackground(Color.BLACK);
            btn.repaint();
          }

          public void keyReleased(KeyEvent e) {
            btn.setBackground(Color.WHITE);
            btn.repaint();
          }
        });
        btnPanel.add(btn);
      }

      rootContainer.add(btnPanel, BorderLayout.NORTH);

    } catch (Throwable t) {
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.