MCPcopy Create free account
hub / github.com/OpenSourcePhysics/osp / getTopPanel

Method getTopPanel

src/test/Test_Event.java:541–593  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

539 }
540
541 private JPanel getTopPanel() {
542 JPanel ptop = new JPanel();
543 ptop.setPreferredSize(new Dimension(300, 300));
544 ptop.setMaximumSize(new Dimension(400, 400));
545 ptop.setBackground(Color.LIGHT_GRAY);
546 ptop.setOpaque(true);
547
548 tarea = new TextArea(2,15) {
549 @Override
550 public boolean getFocusTraversalKeysEnabled() {
551 if(logging)System.out.println("checking textarea traversalkeys " + super.getFocusTraversalKeysEnabled());
552 return super.getFocusTraversalKeysEnabled();
553 }
554
555 };
556 tarea.setFocusTraversalKeysEnabled(false);
557
558 tarea.addFocusListener(fl);
559 ptop.add(tarea);
560
561
562 btnj = new JButton("btnj");
563 btnj.setName("btnj");
564 btnj.setOpaque(true);
565 btnj.setBackground(Color.white);
566 btnj.addMouseListener(ml);
567 btnj.addActionListener(al);
568 btnj.addKeyListener(kl);
569 ptop.add(btnj);
570 field = new TextField("field");
571 field.setName("field");
572 field.addMouseListener(ml);
573 field.addActionListener(al);
574 field.addKeyListener(kl);
575 btn = new Button("test");
576 btn.setName("btn");
577 btn.setBackground(Color.orange);
578 btn.addMouseListener(ml);
579 btn.addActionListener(al);
580 btn.addKeyListener(kl);
581 ptop.add(btn);
582 ptop.add(field);
583 fieldj = new JTextField("fieldj");
584 Keymap m = JTextComponent.getKeymap("TextFieldUI");
585
586 fieldj.setName("fieldj");
587 fieldj.addMouseListener(ml);
588 fieldj.addActionListener(al);
589 fieldj.addKeyListener(kl);
590 ptop.add(fieldj);
591
592 return ptop;
593 }
594
595 protected void updateTitle() {
596 Component c = DefaultKeyboardFocusManager.getCurrentKeyboardFocusManager().getFocusOwner();

Callers 1

Test_EventMethod · 0.95

Calls 6

addFocusListenerMethod · 0.80
addMouseListenerMethod · 0.80
setNameMethod · 0.65
addActionListenerMethod · 0.65
setBackgroundMethod · 0.45
addMethod · 0.45

Tested by

no test coverage detected