javax.swing.Box.setOpaque()方法的使用及代码示例

x33g5p2x  于2022-01-16 转载在 其他  
字(7.3k)|赞(0)|评价(0)|浏览(176)

本文整理了Java中javax.swing.Box.setOpaque()方法的一些代码示例,展示了Box.setOpaque()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Box.setOpaque()方法的具体详情如下:
包路径:javax.swing.Box
类名称:Box
方法名:setOpaque

Box.setOpaque介绍

暂无

代码示例

代码示例来源:origin: stackoverflow.com

setSize(new Dimension(1000, 600));
gameBoard = new JPanel();
gameBoard.setLayout(null);
gameBoard.setOpaque(false);
Dimension expectedDimension = new Dimension(920, 500);
gameBoard.setPreferredSize(expectedDimension);
gameBoard.setMaximumSize(expectedDimension);
gameBoard.setMinimumSize(expectedDimension);
//add cards to gameBoard here

JLabel background = new JLabel( new ImageIcon( getClass().getResource("images/graphic.png") ) );
background.setLocation(79,0); //manually center graphic
background.setBounds(new Rectangle(0, 0, 920, 500));
gameBoard.add(background);

Box centerBox = new Box(BoxLayout.Y_AXIS);
centerBox.setOpaque(true); 
centerBox.setBackground(Color.WHATEVER);
centerBox.add(Box.createVerticalGlue());
centerBox.add(gameBoard);
centerBox.add(Box.createVerticalGlue());
add(centerBox);
setVisible(true);

代码示例来源:origin: jsettlers/settlers-remake

/**
 * Constructor
 */
public MapListCellRenderer() {
  JPanel pFirst = new JPanel();
  pFirst.setOpaque(false);
  pFirst.setLayout(new BorderLayout(5, 0));
  pFirst.add(lbName, BorderLayout.CENTER);
  pFirst.add(lbPlayerCount, BorderLayout.EAST);
  pFirst.setAlignmentX(Component.LEFT_ALIGNMENT);
  pRight.add(pFirst);
  pRight.add(lbMapId);
  lbMapId.setAlignmentX(Component.LEFT_ALIGNMENT);
  pRight.add(lbDescription);
  lbDescription.setAlignmentX(Component.LEFT_ALIGNMENT);
  pRight.setOpaque(false);
  pRight.setBorder(BorderFactory.createEmptyBorder(10, 10, 10, 10));
  lbName.setFont(lbName.getFont().deriveFont(Font.BOLD));
  lbName.setAlignmentX(Component.LEFT_ALIGNMENT);
  lbName.setForeground(FOREGROUND);
  lbMapId.setForeground(FOREGROUND);
  lbDescription.setForeground(FOREGROUND);
  lbPlayerCount.setForeground(Color.BLUE);
  pContents.setLayout(new BorderLayout());
  pContents.add(pRight, BorderLayout.CENTER);
  pContents.add(lbIcon, BorderLayout.WEST);
  lbIcon.setOpaque(false);
  lbIcon.setBorder(BorderFactory.createEmptyBorder(1, 0, 1, 0));
}

代码示例来源:origin: jsettlers/settlers-remake

descriptionLabel.setAlignmentX(Component.LEFT_ALIGNMENT);
rightPanelPart.setOpaque(false);
rightPanelPart.setBorder(BorderFactory.createEmptyBorder(10, 10, 10, 10));
mapNameLabel.setFont(mapNameLabel.getFont().deriveFont(Font.BOLD));

代码示例来源:origin: edu.stanford.protege/org.protege.editor.owl

public void initialiseView() throws Exception {
  setLayout(new BorderLayout());
  checkBox = new JCheckBox("Functional");
  Box box = new Box(BoxLayout.PAGE_AXIS);
  box.setOpaque(false);
  box.add(checkBox);
  add(new JScrollPane(box));
  listener = new FilteringOWLOntologyChangeListener() {
    public void visit(OWLFunctionalDataPropertyAxiom axiom) {
      updateView(prop);
    }
  };
  getOWLModelManager().addOntologyChangeListener(listener);
  checkBox.addActionListener(new ActionListener() {
    public void actionPerformed(ActionEvent e) {
      updateOntology();
    }
  });
}

代码示例来源:origin: eugener/oxbow

commands.setBorder( BorderFactory.createEmptyBorder(3, 0, 3, 0));
commands.setBackground(UIManager.getColor("Panel.background"));
commands.setOpaque(true);

代码示例来源:origin: protegeproject/protege

public void initialiseView() throws Exception {
  setLayout(new BorderLayout());
  checkBox = new JCheckBox("Functional");
  Box box = new Box(BoxLayout.PAGE_AXIS);
  box.setOpaque(false);
  box.add(checkBox);
  add(new JScrollPane(box));
  listener = new FilteringOWLOntologyChangeListener() {
    public void visit(OWLFunctionalDataPropertyAxiom axiom) {
      updateView(prop);
    }
  };
  getOWLModelManager().addOntologyChangeListener(listener);
  checkBox.addActionListener(e -> {
    updateOntology();
  });
}

代码示例来源:origin: aterai/java-swing-tips

private MainPanel() {
 super(new BorderLayout());
 Box accordion = Box.createVerticalBox();
 accordion.setOpaque(true);
 accordion.setBackground(new Color(180, 180, 255));
 accordion.setBorder(BorderFactory.createEmptyBorder(10, 5, 5, 5));
 makeExpansionPanelList().forEach(p -> {
  accordion.add(p);
  accordion.add(Box.createVerticalStrut(5));
 });
 accordion.add(Box.createVerticalGlue());
 JScrollPane scroll = new JScrollPane(accordion);
 scroll.setHorizontalScrollBarPolicy(ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER);
 scroll.getVerticalScrollBar().setUnitIncrement(25);
 JSplitPane split = new JSplitPane();
 split.setResizeWeight(.5);
 split.setDividerSize(2);
 split.setLeftComponent(scroll);
 split.setRightComponent(new JLabel("Dummy"));
 add(split);
 setPreferredSize(new Dimension(320, 240));
}

代码示例来源:origin: org.protege/protege-editor-owl

public void initialiseView() throws Exception {
  setLayout(new BorderLayout());
  checkBox = new JCheckBox("Functional");
  Box box = new Box(BoxLayout.PAGE_AXIS);
  box.setOpaque(false);
  box.add(checkBox);
  add(new JScrollPane(box));
  listener = new FilteringOWLOntologyChangeListener() {
    public void visit(OWLFunctionalDataPropertyAxiom axiom) {
      updateView(prop);
    }
  };
  getOWLModelManager().addOntologyChangeListener(listener);
  checkBox.addActionListener(new ActionListener() {
    public void actionPerformed(ActionEvent e) {
      updateOntology();
    }
  });
}

代码示例来源:origin: edu.stanford.protege/protege-editor-owl

public void initialiseView() throws Exception {
  setLayout(new BorderLayout());
  checkBox = new JCheckBox("Functional");
  Box box = new Box(BoxLayout.PAGE_AXIS);
  box.setOpaque(false);
  box.add(checkBox);
  add(new JScrollPane(box));
  listener = new FilteringOWLOntologyChangeListener() {
    public void visit(OWLFunctionalDataPropertyAxiom axiom) {
      updateView(prop);
    }
  };
  getOWLModelManager().addOntologyChangeListener(listener);
  checkBox.addActionListener(e -> {
    updateOntology();
  });
}

代码示例来源:origin: org.bidib.org.oxbow/swingbits

commands.setBorder( BorderFactory.createEmptyBorder(3, 0, 3, 0));
commands.setBackground(UIManager.getColor("Panel.background"));
commands.setOpaque(true);

代码示例来源:origin: stackoverflow.com

JFrame f = new JFrame();
f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
center.setOpaque(true);
center.setBackground(Color.lightGray);
center.add(Box.createVerticalGlue());

代码示例来源:origin: protegeproject/protege

box.setOpaque(false);
box.add(functionalCB);
box.add(Box.createVerticalStrut(7));

代码示例来源:origin: io.ultreia.java4all.jaxx/jaxx-widgets-extra

commands.setBorder(BorderFactory.createEmptyBorder(3, 0, 3, 0));
commands.setBackground(UIManager.getColor("Panel.background"));
commands.setOpaque(true);

代码示例来源:origin: org.nuiton.jaxx/jaxx-widgets

commands.setBorder(BorderFactory.createEmptyBorder(3, 0, 3, 0));
commands.setBackground(UIManager.getColor("Panel.background"));
commands.setOpaque(true);

代码示例来源:origin: edu.stanford.protege/org.protege.editor.owl

box.setOpaque(false);
box.add(functionalCB);
box.add(Box.createVerticalStrut(7));

代码示例来源:origin: org.protege/protege-editor-owl

box.setOpaque(false);
box.add(functionalCB);
box.add(Box.createVerticalStrut(7));

代码示例来源:origin: edu.stanford.protege/protege-editor-owl

box.setOpaque(false);
box.add(functionalCB);
box.add(Box.createVerticalStrut(7));

代码示例来源:origin: stackoverflow.com

mainPanel.setOpaque (true);
mainPanel.add (new HintedTextField (12, "Login"));
mainPanel.add (Box.createVerticalStrut (1));

代码示例来源:origin: xyz.cofe/docking-frames-ext-toolbar

@Override
public void bind( CustomizationMenuCallback callback ){
  view = Box.createVerticalBox();
  view.setOpaque(true);
  for (final CustomizationMenuContent item : content){
    item.bind(callback);
    if (item.getView() instanceof JComponent){
      ((JComponent) item.getView())
          .setAlignmentX(Component.LEFT_ALIGNMENT);
    }
    view.add(item.getView());
  }
}

代码示例来源:origin: protegeproject/protege

tablePanel.setOpaque(false);
box.add(tablePanel);
box.setOpaque(false);

相关文章