Tabnine Logo
JFrame.setBackground
Code IndexAdd Tabnine to your IDE (free)

How to use
setBackground
method
in
javax.swing.JFrame

Best Java code snippets using javax.swing.JFrame.setBackground (Showing top 20 results out of 315)

origin: stanfordnlp/CoreNLP

private void displayTsurgeonHelp() {
 if(tsurgeonHelpFrame != null) {
  tsurgeonHelpFrame.setVisible(true);
 } else {
  tsurgeonHelpFrame = new JFrame("TSurgeon Help...");
  JEditorPane helpText = new JEditorPane();
  helpText.setContentType("text/html");
  // StringBuffer s = new StringBuffer();
  // s.append(htmlTsurgeonHelp);
  helpText.setText(htmlTsurgeonHelp);
  helpText.setEditable(false);
  JScrollPane scroller = new JScrollPane(helpText);
  helpText.setCaretPosition(0);
  scroller.setPreferredSize(new Dimension(500,500));
  tsurgeonHelpFrame.add(scroller);
  tsurgeonHelpFrame.pack();
  tsurgeonHelpFrame.setBackground(Color.WHITE);
  tsurgeonHelpFrame.setVisible(true);
 }
}
origin: stanfordnlp/CoreNLP

private void displayHelp() {
 if (helpFrame != null) {
  helpFrame.setVisible(true);
 } else {
  helpFrame = new JFrame("Tregex Help...");
  //JPanel helpPanel = new JPanel();
  JEditorPane helpText = new JEditorPane();
  helpText.setContentType("text/html");
  // StringBuffer s = new StringBuffer();
  // s.append(htmlHelp);
  helpText.setText(htmlHelp);
  helpText.setEditable(false);
  //helpPanel.add(helpText);
  JScrollPane scroller = new JScrollPane(helpText);
  helpText.setCaretPosition(0);
  scroller.setPreferredSize(new Dimension(500,500));
  helpFrame.add(scroller);
  helpFrame.pack();
  helpFrame.setBackground(Color.WHITE);
  helpFrame.setVisible(true);
  //helpFrame.repaint();
 }
}
origin: stanfordnlp/CoreNLP

private void showHistory() {
 if (historyFrame == null) {
  historyFrame = new JFrame("Statistics History");
 } else {
  historyFrame.setVisible(false);
  historyFrame= new JFrame("Statistics History");
 }
 historyFrame.setLayout(new GridLayout(1,0));
 Object[][] entries = new Object[historyList.size()][3];
 for(int i = 0; i < historyList.size(); i++) {
  entries[i] = historyList.get(i).toArray();
 }
 DefaultTableModel tableModel = new TregexGUITableModel(entries, HistoryEntry.columnNamesArray());
 JTable statTable = new JTable(tableModel);
 DefaultTableCellRenderer dtcr = (DefaultTableCellRenderer) statTable.getDefaultRenderer(String.class);
 dtcr.setHorizontalAlignment(DefaultTableCellRenderer.CENTER);
 JScrollPane scroller = new JScrollPane(statTable);
 historyFrame.add(scroller);
 historyFrame.pack();
 historyFrame.setLocationRelativeTo(TregexGUI.getInstance());
 historyFrame.setBackground(Color.WHITE);
 historyFrame.setVisible(true);
 historyFrame.repaint();
}
origin: wildfly/wildfly

public void go() throws Exception {
  if(!no_channel && !use_state)
    channel.connect(cluster_name);
  mainFrame=new JFrame();
  mainFrame.setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE);
  panel=new DrawPanel(use_state);
  panel.setBackground(background_color);
  sub_panel=new JPanel();
  mainFrame.getContentPane().add("Center", panel);
  clear_button=new JButton("Clear");
  clear_button.setFont(default_font);
  clear_button.addActionListener(this);
  leave_button=new JButton("Leave");
  leave_button.setFont(default_font);
  leave_button.addActionListener(this);
  sub_panel.add("South", clear_button);
  sub_panel.add("South", leave_button);
  mainFrame.getContentPane().add("South", sub_panel);
  mainFrame.setBackground(background_color);
  clear_button.setForeground(Color.blue);
  leave_button.setForeground(Color.blue);
  mainFrame.pack();
  mainFrame.setLocation(15, 25);
  mainFrame.setBounds(new Rectangle(250, 250));
  if(!no_channel && use_state) {
    channel.connect(cluster_name, null, state_timeout);
  }
  mainFrame.setVisible(true);
  setTitle();
}
origin: wildfly/wildfly

sub_panel.add("South", leave_button);
mainFrame.getContentPane().add("South", sub_panel);
mainFrame.setBackground(background_color);
clear_button.setForeground(Color.blue);
leave_button.setForeground(Color.blue);
origin: wildfly/wildfly

public void start() throws Exception {
  mainFrame=new JFrame("Chat demo");
  mainFrame.setPreferredSize(new Dimension(600,600));
  mainFrame.setBackground(Color.white);
  mainFrame.addWindowListener(new WindowAdapter() {
    public void windowClosing(WindowEvent e) {
origin: stackoverflow.com

 public class Overlay {

  public static void main(String[] args) {
    JFrame frame = new JFrame("Transparent Window");
    frame.setUndecorated(true);
    frame.setBackground(new Color(0, 0, 0, 0));
    frame.setAlwaysOnTop(true);
    // Without this, the window is draggable from any non transparent
    // point, including points  inside textboxes.
    frame.getRootPane().putClientProperty("apple.awt.draggableWindowBackground", false);

    frame.getContentPane().setLayout(new java.awt.BorderLayout());
    frame.getContentPane().add(new JTextField("text field north"), java.awt.BorderLayout.NORTH);
    frame.getContentPane().add(new JTextField("text field south"), java.awt.BorderLayout.SOUTH);
    frame.setVisible(true);
    frame.pack();
  }
}
origin: RaiMan/SikuliX2

JFrame frame = new JFrame();
frame.setUndecorated(true);
frame.setBackground(new Color(0, 0, 0, 0.1f));
origin: fossasia/neurolab-desktop

window.setBackground(Color.WHITE);
window.setSize(windowWidth, windowHeight);
window.move(0, nfbServer.height + 120);
origin: stackoverflow.com

 JFrame p = new JFrame();
p.add(new SingleImagePanel(new SourceImage(filename)));
p.setBackground(Color.BLACK);
p.setSize(512,512);
p.setVisible(true);
origin: stackoverflow.com

JLabel click=new JLabel("Click me");
click.addMouseListener(new MouseAdapter() {
   public void mouseClicked(MouseEvent e) {
     JFrame jf=new JFrame("new one");
   jf.setBackground(Color.BLACK);
   jf.setSize(new Dimension(200,70));
   jf.setVisible(true);
   jf.setDefaultCloseOperation(EXIT_ON_CLOSE);
   }
 });
origin: stackoverflow.com

 public void answer(){
  int area = (int) (length * width);  //  <--- Move this inside answer method
  JFrame answer = new JFrame();
  answer.setBackground(Color.yellow);
  JPanel pan2 = new JPanel();
  JLabel howanswer = new JLabel("Your answer is" + area + "We got this by multiplying the length and width");
  pan2.add(howanswer);
  answer.add(pan2); //  <--- Don't forget to add your components to the frame
  answer.pack();    //  <--- Resize the frame to a suitable size
  answer.setVisible(true); //  <--- Set the frame to visible AFTER you have added the components

}
origin: stackoverflow.com

 JFrame f = new JFrame();
f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
f.setBackground(new Color(0f, 0f, 0f, 0.1f));
f.setUndecorated(true);
f.add(new JLabel("<html>Testing<br>1, 2, 3</html>"));
f.pack();
f.setLocationRelativeTo(null);
f.setVisible(true);
origin: stackoverflow.com

 public static void startGame(JPanel panel) {
  JFrame f = new JFrame("Journey To Carzett");
  f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
  f.setResizable(true);
  f.setBackground(Color.GRAY);
  f.setVisible(true);
  f.setSize(750, 500);
  f.getContentPane(panel);
  f.pack();
  f.setVisible(true);
}
origin: stackoverflow.com

 JFrame frame = new JFrame("Testing");
frame.setUndecorated(true);
frame.setBackground(new Color(0, 0, 0, 0));
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
frame.add(new TestPane());
frame.pack();
frame.setLocationRelativeTo(null);
frame.setVisible(true);
origin: stackoverflow.com

 public static void main(String args[]) {
  JFrame window = new JFrame("l");
  window.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); // <-- Handle closing 
                      // the window.
  Color black = new Color(0, 0, 0);
  window.setBackground(black);
  window.setSize(new Dimension(500, 500)); // <-- set a size.
  window.setVisible(true); // <-- set it visible.
  JDialog start = new JDialog(window, ";;");
  start.setSize(new Dimension(300, 300)); // <-- set a size.
  start.setVisible(true); // <-- set it visible.
}
origin: stackoverflow.com

 Component c; // the component you would like to print to a BufferedImage
JFrame frame = new JFrame();
frame.setBackground(Color.WHITE);
frame.setUndecorated(true);
frame.getContentPane().add(c);
frame.pack();
BufferedImage bi = new BufferedImage(c.getWidth(), c.getHeight(), BufferedImage.TYPE_INT_ARGB);
Graphics2D graphics = bi.createGraphics();
c.print(graphics);
graphics.dispose();
frame.dispose();
origin: stackoverflow.com

 JFrame frame = new JFrame("Testing");
frame.setLayout(new FlowLayout()); // New line of code
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
frame.setPreferredSize(new Dimension(1000, 2000));  // Modified line of code
frame.setBackground(Color.WHITE);

JPanel jp = new JPanel();
jp.setBackground(Color.BLUE);
jp.setPreferredSize(new Dimension(40, 40)); // Modified line of code
frame.add(jp);

frame.pack(); // added line of code
frame.setVisible(true);
origin: Exslims/MercuryTrade

  public static void createAndShowGUI() {
    JFrame frame = new JFrame("@title@");
    frame.setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE);
    frame.getContentPane().add(new AdrTesting());
    frame.setUndecorated(true);
    frame.setBackground(AppThemeColor.FRAME);
    frame.pack();
    frame.setLocationRelativeTo(null);
    frame.setVisible(true);
  }
}
origin: stackoverflow.com

JFrame frame = new JFrame();
frame.add(new ImagePanel());
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
frame.setUndecorated(true);
frame.pack(); 
frame.setBackground(new Color(0, 0, 0, 0)); 
frame.setVisible(true);
javax.swingJFramesetBackground

Popular methods of JFrame

  • <init>
  • setVisible
  • setDefaultCloseOperation
  • pack
  • getContentPane
  • setSize
  • add
  • addWindowListener
  • dispose
  • setTitle
  • setContentPane
  • setLocation
  • setContentPane,
  • setLocation,
  • setLocationRelativeTo,
  • setJMenuBar,
  • setLayout,
  • setResizable,
  • setIconImage,
  • setBounds,
  • getRootPane,
  • getSize

Popular in Java

  • Making http post requests using okhttp
  • scheduleAtFixedRate (ScheduledExecutorService)
  • requestLocationUpdates (LocationManager)
  • putExtra (Intent)
  • VirtualMachine (com.sun.tools.attach)
    A Java virtual machine. A VirtualMachine represents a Java virtual machine to which this Java vir
  • Window (java.awt)
    A Window object is a top-level window with no borders and no menubar. The default layout for a windo
  • Dictionary (java.util)
    Note: Do not use this class since it is obsolete. Please use the Map interface for new implementatio
  • TimeUnit (java.util.concurrent)
    A TimeUnit represents time durations at a given unit of granularity and provides utility methods to
  • HttpServlet (javax.servlet.http)
    Provides an abstract class to be subclassed to create an HTTP servlet suitable for a Web site. A sub
  • Option (scala)
  • Top PhpStorm plugins
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now