java.awt.Container.setBackground()方法的使用及代码示例

x33g5p2x  于2022-01-17 转载在 其他  
字(6.2k)|赞(0)|评价(0)|浏览(246)

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

Container.setBackground介绍

暂无

代码示例

代码示例来源:origin: 4thline/cling

@Override
public void setStatus(boolean on) {
  if (on) {
    iconLabel.setIcon(onIcon);
    getContentPane().setBackground(Constants.GREEN_DARK);
    setTitle("Status: ON");
  } else {
    iconLabel.setIcon(offIcon);
    getContentPane().setBackground(Color.BLACK);
    setTitle("Status: OFF");
  }
}

代码示例来源:origin: 4thline/cling

GridPanelFrame(int width, int height) throws HeadlessException {
  setUndecorated(true);
  setResizable(false);
  setPreferredSize(new Dimension(width, height));
  getContentPane().setBackground(Color.BLACK);
  getContentPane().setLayout(new GridLayout(1,1));
}

代码示例来源:origin: stanfordnlp/CoreNLP

content.setBackground(Color.lightGray);

代码示例来源:origin: RaiMan/SikuliX2

pane.setBackground(Color.yellow);
int n = args.length;
String e;

代码示例来源:origin: ron190/jsql-injection

if (p instanceof JWindow || p instanceof Panel) {
  p.setBackground(contents.getBackground());
  this.heavyWeightContainer = p;
  break;

代码示例来源:origin: RaiMan/SikuliX2

introPane.setBackground(Color.white);
String aText = Content.extractResourceToString("/gui", "toolIntro.html");
JLabel introText = new JLabel(aText);

代码示例来源:origin: RaiMan/SikuliX2

pBox.setBackground(Color.white);
status.setOpaque(true);
status.setBackground(Color.white);

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

private void RenkMouseClicked(java.awt.event.MouseEvent evt) {
  renk = JColorChooser.showDialog(null, "Select the background color",
      renk);
  Container a = this.getContentPane();
  a.setBackground(renk);
}

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

public void actionPerformed(ActionEvent e)
{
  Container contentPane = getContentPane();

  if (!on) {
      contentPane.setBackground(Color.YELLOW);
      on = true;
  }
  else  {
    contentPane.setBackground(Color.DARK_GRAY);
    on = false;
  }
}

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

public Hangman() {
  Container c = getContentPane();
  c.setBackground(Color.BLACK);
  JTextField input = new JTextField(20);
  c.setLayout(new BorderLayout());
  c.add(input, BorderLayout.SOUTH);
}

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

public static void main(String[] args) throws Throwable
{
  JFrame frame = new JFrame();
  frame.setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE);
  Container cp = frame.getContentPane();
  cp.setBackground(Color.RED);
  cp.setLayout(new FlowLayout());

  cp.add(new JLabel(new ImageIcon(new URL("http://i.stack.imgur.com/BvYxM.png"))));
  cp.add(new JLabel(new ImageIcon(new URL("http://www.axdn.com/redist/axpssp_logo.png"))));

  frame.pack();
  frame.setVisible(true);
}

代码示例来源:origin: org.antlr/antlr4

public void save(String fileName) throws IOException, PrintException {
  JFrame dialog = new JFrame();
  Container contentPane = dialog.getContentPane();
  ((JComponent) contentPane).setBorder(BorderFactory.createEmptyBorder(
      10, 10, 10, 10));
  contentPane.add(this);
  contentPane.setBackground(Color.white);
  dialog.pack();
  dialog.setLocationRelativeTo(null);
  dialog.dispose();
  GraphicsSupport.saveImage(this, fileName);
}

代码示例来源:origin: com.impetus.fabric/fabric-jdbc-driver-shaded

public void save(String fileName) throws IOException, PrintException {
  JDialog dialog = new JDialog();
  Container contentPane = dialog.getContentPane();
  ((JComponent) contentPane).setBorder(BorderFactory.createEmptyBorder(
      10, 10, 10, 10));
  contentPane.add(this);
  contentPane.setBackground(Color.white);
  dialog.pack();
  dialog.setLocationRelativeTo(null);
  dialog.dispose();
  GraphicsSupport.saveImage(this, fileName);
}

代码示例来源:origin: datacleaner/DataCleaner

public DCGlassPane(final JRootPane rootpane) {
  _rootPane = rootpane;
  _glassPane = (Container) rootpane.getGlassPane();
  _glassPane.setLayout(null);
  _glassPane.setBackground(WidgetUtils.BG_COLOR_DARKEST);
}

代码示例来源:origin: uk.co.nichesolutions/antlr4

public void save(String fileName) throws IOException, PrintException {
  JDialog dialog = new JDialog();
  Container contentPane = dialog.getContentPane();
  ((JComponent) contentPane).setBorder(BorderFactory.createEmptyBorder(
      10, 10, 10, 10));
  contentPane.add(this);
  contentPane.setBackground(Color.white);
  dialog.pack();
  dialog.setLocationRelativeTo(null);
  dialog.dispose();
  GraphicsSupport.saveImage(this, fileName);
}

代码示例来源:origin: io.virtdata/virtdata-lib-realer

public void save(String fileName) throws IOException, PrintException {
  JFrame dialog = new JFrame();
  Container contentPane = dialog.getContentPane();
  ((JComponent) contentPane).setBorder(BorderFactory.createEmptyBorder(
      10, 10, 10, 10));
  contentPane.add(this);
  contentPane.setBackground(Color.white);
  dialog.pack();
  dialog.setLocationRelativeTo(null);
  dialog.dispose();
  GraphicsSupport.saveImage(this, fileName);
}

代码示例来源:origin: org.netbeans.modules/org-netbeans-modules-spring-beans

/** Creates new form SpringXMLConfigGroupVisual */
public SpringXMLConfigGroupVisual(List<ConfigFileGroup> configFileGroups) {
  initComponents();
  groupsTable.getParent().setBackground(groupsTable.getBackground());
  groupsTable.setModel(new ConfigGroupSelectionTableModel(configFileGroups));
  groupsTable.getColumnModel().getColumn(0).setMaxWidth(0);
  groupsTable.getSelectionModel().setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
}

代码示例来源:origin: org.netbeans.modules/org-netbeans-modules-spring-beans

public SpringXMLConfigNamespacesVisual() {
    initComponents();
    // set the color of the table's JViewport
    includesTable.getParent().setBackground(includesTable.getBackground());
    TableColumn col1 = includesTable.getColumnModel().getColumn(0);
    col1.setMaxWidth(0);
    includesTable.getSelectionModel().setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
    includesTable.revalidate();
//        springLibrary = SpringUtilities.findSpringLibrary();
  }

代码示例来源:origin: datacleaner/DataCleaner

public AbstractWindow(final WindowContext windowContext) {
  _windowContext = windowContext;
  setMinimumSize(new Dimension(MIN_WIDTH, MIN_HEIGHT));
  setDefaultCloseOperation(JFrame.DO_NOTHING_ON_CLOSE);
  addWindowListener(this);
  getContentPane().setBackground(WidgetUtils.BG_COLOR_BRIGHT);
}

代码示例来源:origin: com.jalalkiswani/jk-desktop

private void init() {
  setOpaque(true);
  getContentPane().setBackground(JKColors.MAIN_PANEL_BG);
  setBackground(JKColors.MAIN_PANEL_BG);
  setDefaultCloseOperation(DISPOSE_ON_CLOSE);
  // setExtendedState(MAXIMIZED_BOTH);
  setSize(DEFAULT_WIDTH, DEFAULT_HEIGHT);
  // setLocationRelativeTo(null);
  setComponentOrientation(SwingUtility.getDefaultComponentOrientation());
}

相关文章

微信公众号

最新文章

更多

Container类方法