How to make jframe transparent?

Hi
  some software's uses the monitor as a whiteboard to draw or to type text. How is this possible? I mean i thought that by making a  jframe (full screen) transparent we should be able to do this?   Is my understanding right? if so how to make the jframe transparent? when jframe is transparent will we be able to draw on it?

Try this:
public static void main(String[] args) {
  SwingUtilities.invokeLater(new Runnable() {
  @Override public void run() {
  JFrame f = new JFrame();
  f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
  f.setUndecorated(true);
  f.setBackground(new Color(0,0,0,0));
  f.setExtendedState(JFrame.MAXIMIZED_BOTH);
  f.add(new JComponent() {
  @Override protected void paintComponent(Graphics g) {
  g.setColor(Color.BLUE);
  ((Graphics2D)g).setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);
  g.fillOval(0, 0, getWidth(), getHeight());
  f.setVisible(true);
Message was edited by: 946128 in respose to PhHein's comment

Similar Messages

  • How to make a transparent Frame

    How to make a transparent Frame , just like the .NET Frame ??

    Maybe searching the forum using the keywords "+transparent +frame" or "+transparent +jframe" would be a good place to start.

  • How to make treetable transparent

    hi,
    Does anyone have idea how to make the treetable transparent so that the background image can be shown?
    Pls provide sample code if possible,thanks!

    I don't know if I can come up with some code example
    for you since I don't know what treetable your are
    using... but... Transparency is always going to relate
    to the whether your components are opaque or not.
    Opaque = Not Transparent, so setting opaque = false
    will hopefully make your table transparent. You may
    need to do this on your CellRenderer's as well.
    Hope this helps,
    Josh Castagno
    http://www.jdc-software.com
    hi,
    i am using JTreeTable provided fron Sun swing connection article,by Scott Violet and Kathy Walrath.
    The situation i am facng now is jtree able to be transparent, but jtable still using it default background.
    Below are excerpt from sample, setOpaque(false) to jtable seem doesn't take effect.
    As i an newbie to swing,kindly point out where part shd i modified on the code. Thz!
    import java.awt.*;
    import javax.swing.*;
    import javax.swing.border.*;
    import javax.swing.event.*;
    import javax.swing.tree.*;
    import javax.swing.table.*;
    import java.awt.event.*;
    import java.util.EventObject;
    * This example shows how to create a simple JTreeTable component,
    * by using a JTree as a renderer (and editor) for the cells in a
    * particular column in the JTable.
    * @version 1.2 10/27/98
    * @author Philip Milne
    * @author Scott Violet
    public class JTreeTable extends JTable {
    /** A subclass of JTree. */
    protected TreeTableCellRenderer tree;
    public JTreeTable(TreeTableModel treeTableModel) {
         super();
         // Creates the tree. It will be used as a renderer and editor.
         tree = new TreeTableCellRenderer(treeTableModel);
         // Installs a tableModel representing the visible rows in the tree.
         super.setModel(new TreeTableModelAdapter(treeTableModel, tree));
         // Forces the JTable and JTree to share their row selection models.
         ListToTreeSelectionModelWrapper selectionWrapper = new
         ListToTreeSelectionModelWrapper();
         tree.setSelectionModel(selectionWrapper);
         setSelectionModel(selectionWrapper.getListSelectionModel());
         // Installs the tree editor renderer and editor.
         setDefaultRenderer(TreeTableModel.class, tree);
         setDefaultEditor(TreeTableModel.class, new TreeTableCellEditor());
         // No grid.
         setShowGrid(false);
    //added
    setOpaque(false);
         // No intercell spacing
         setIntercellSpacing(new Dimension(0, 0));     
         // And update the height of the trees row to match that of
         // the table.
         if (tree.getRowHeight() < 1) {
         // Metal looks better like this.
         setRowHeight(20);
    * Overridden to message super and forward the method to the tree.
    * Since the tree is not actually in the component hierarchy it will
    * never receive this unless we forward it in this manner.
    public void updateUI() {
         super.updateUI();
         if(tree != null) {
         tree.updateUI();
         // Do this so that the editor is referencing the current renderer
         // from the tree. The renderer can potentially change each time
         // laf changes.
         setDefaultEditor(TreeTableModel.class, new TreeTableCellEditor());
         // Use the tree's default foreground and background colors in the
         // table.
    LookAndFeel.installColorsAndFont(this, "Tree.background",
    "Tree.foreground", "Tree.font");
    * Workaround for BasicTableUI anomaly. Make sure the UI never tries to
    * resize the editor. The UI currently uses different techniques to
    * paint the renderers and editors; overriding setBounds() below
    * is not the right thing to do for an editor. Returning -1 for the
    * editing row in this case, ensures the editor is never painted.
    public int getEditingRow() {
    return (getColumnClass(editingColumn) == TreeTableModel.class) ? -1 :
         editingRow;
    * Returns the actual row that is editing as <code>getEditingRow</code>
    * will always return -1.
    private int realEditingRow() {
         return editingRow;
    * This is overridden to invoke super's implementation, and then,
    * if the receiver is editing a Tree column, the editor's bounds is
    * reset. The reason we have to do this is because JTable doesn't
    * think the table is being edited, as <code>getEditingRow</code> returns
    * -1, and therefore doesn't automatically resize the editor for us.
    public void sizeColumnsToFit(int resizingColumn) {
         super.sizeColumnsToFit(resizingColumn);
         if (getEditingColumn() != -1 && getColumnClass(editingColumn) ==
         TreeTableModel.class) {
         Rectangle cellRect = getCellRect(realEditingRow(),
                             getEditingColumn(), false);
    Component component = getEditorComponent();
         component.setBounds(cellRect);
    component.validate();
    * Overridden to pass the new rowHeight to the tree.
    public void setRowHeight(int rowHeight) {
    super.setRowHeight(rowHeight);
         if (tree != null && tree.getRowHeight() != rowHeight) {
    tree.setRowHeight(getRowHeight());
    * Returns the tree that is being shared between the model.
    public JTree getTree() {
         return tree;
    * Overridden to invoke repaint for the particular location if
    * the column contains the tree. This is done as the tree editor does
    * not fill the bounds of the cell, we need the renderer to paint
    * the tree in the background, and then draw the editor over it.
    public boolean editCellAt(int row, int column, EventObject e){
         boolean retValue = super.editCellAt(row, column, e);
         if (retValue && getColumnClass(column) == TreeTableModel.class) {
         repaint(getCellRect(row, column, false));
         return retValue;
    * A TreeCellRenderer that displays a JTree.
    public class TreeTableCellRenderer extends JTree implements
         TableCellRenderer {
         /** Last table/tree row asked to renderer. */
         protected int visibleRow;
         /** Border to draw around the tree, if this is non-null, it will
         * be painted. */
         protected Border highlightBorder;
         public TreeTableCellRenderer(TreeModel model) {
         super(model);
         * updateUI is overridden to set the colors of the Tree's renderer
         * to match that of the table.
         public void updateUI() {
         super.updateUI();
         // Make the tree's cell renderer use the table's cell selection
         // colors.
         TreeCellRenderer tcr = getCellRenderer();
         if (tcr instanceof DefaultTreeCellRenderer) {
              DefaultTreeCellRenderer dtcr = ((DefaultTreeCellRenderer)tcr);
              // For 1.1 uncomment this, 1.2 has a bug that will cause an
              // exception to be thrown if the border selection color is
              // null.
              // dtcr.setBorderSelectionColor(null);
              dtcr.setTextSelectionColor(UIManager.getColor
                             ("Table.selectionForeground"));
              dtcr.setBackgroundSelectionColor(UIManager.getColor
                                  ("Table.selectionBackground"));
         * Sets the row height of the tree, and forwards the row height to
         * the table.
         public void setRowHeight(int rowHeight) {
         if (rowHeight > 0) {
              super.setRowHeight(rowHeight);
              if (JTreeTable.this != null &&
              JTreeTable.this.getRowHeight() != rowHeight) {
              JTreeTable.this.setRowHeight(getRowHeight());
         * This is overridden to set the height to match that of the JTable.
         public void setBounds(int x, int y, int w, int h) {
         super.setBounds(x, 0, w, JTreeTable.this.getHeight());
         * Sublcassed to translate the graphics such that the last visible
         * row will be drawn at 0,0.
         public void paint(Graphics g) {
         g.translate(0, -visibleRow * getRowHeight());
         super.paint(g);
         // Draw the Table border if we have focus.
         if (highlightBorder != null) {
              highlightBorder.paintBorder(this, g, 0, visibleRow *
                             getRowHeight(), getWidth(),
                             getRowHeight());
         * TreeCellRenderer method. Overridden to update the visible row.
         public Component getTableCellRendererComponent(JTable table,
                                  Object value,
                                  boolean isSelected,
                                  boolean hasFocus,
                                  int row, int column) {
         Color background;
         Color foreground;
         if(isSelected) {
              background = table.getSelectionBackground();
              foreground = table.getSelectionForeground();
         else {
              background = table.getBackground();
              foreground = table.getForeground();
         highlightBorder = null;
         if (realEditingRow() == row && getEditingColumn() == column) {
              background = UIManager.getColor("Table.focusCellBackground");
              foreground = UIManager.getColor("Table.focusCellForeground");
         else if (hasFocus) {
              highlightBorder = UIManager.getBorder
              ("Table.focusCellHighlightBorder");
              if (isCellEditable(row, column)) {
              background = UIManager.getColor
                   ("Table.focusCellBackground");
              foreground = UIManager.getColor
                   ("Table.focusCellForeground");
         visibleRow = row;
         setBackground(background);
         TreeCellRenderer tcr = getCellRenderer();
         if (tcr instanceof DefaultTreeCellRenderer) {
              DefaultTreeCellRenderer dtcr = ((DefaultTreeCellRenderer)tcr);
              if (isSelected) {
              dtcr.setTextSelectionColor(foreground);
              dtcr.setBackgroundSelectionColor(background);
              else {
              dtcr.setTextNonSelectionColor(foreground);
              dtcr.setBackgroundNonSelectionColor(background);
         return this;
    * An editor that can be used to edit the tree column. This extends
    * DefaultCellEditor and uses a JTextField (actually, TreeTableTextField)
    * to perform the actual editing.
    * <p>To support editing of the tree column we can not make the tree
    * editable. The reason this doesn't work is that you can not use
    * the same component for editing and renderering. The table may have
    * the need to paint cells, while a cell is being edited. If the same
    * component were used for the rendering and editing the component would
    * be moved around, and the contents would change. When editing, this
    * is undesirable, the contents of the text field must stay the same,
    * including the caret blinking, and selections persisting. For this
    * reason the editing is done via a TableCellEditor.
    * <p>Another interesting thing to be aware of is how tree positions
    * its render and editor. The render/editor is responsible for drawing the
    * icon indicating the type of node (leaf, branch...). The tree is
    * responsible for drawing any other indicators, perhaps an additional
    * +/- sign, or lines connecting the various nodes. So, the renderer
    * is positioned based on depth. On the other hand, table always makes
    * its editor fill the contents of the cell. To get the allusion
    * that the table cell editor is part of the tree, we don't want the
    * table cell editor to fill the cell bounds. We want it to be placed
    * in the same manner as tree places it editor, and have table message
    * the tree to paint any decorations the tree wants. Then, we would
    * only have to worry about the editing part. The approach taken
    * here is to determine where tree would place the editor, and to override
    * the <code>reshape</code> method in the JTextField component to
    * nudge the textfield to the location tree would place it. Since
    * JTreeTable will paint the tree behind the editor everything should
    * just work. So, that is what we are doing here. Determining of
    * the icon position will only work if the TreeCellRenderer is
    * an instance of DefaultTreeCellRenderer. If you need custom
    * TreeCellRenderers, that don't descend from DefaultTreeCellRenderer,
    * and you want to support editing in JTreeTable, you will have
    * to do something similiar.
    public class TreeTableCellEditor extends DefaultCellEditor {
         public TreeTableCellEditor() {
         super(new TreeTableTextField());
         * Overridden to determine an offset that tree would place the
         * editor at. The offset is determined from the
         * <code>getRowBounds</code> JTree method, and additionally
         * from the icon DefaultTreeCellRenderer will use.
         * <p>The offset is then set on the TreeTableTextField component
         * created in the constructor, and returned.
         public Component getTableCellEditorComponent(JTable table,
                                  Object value,
                                  boolean isSelected,
                                  int r, int c) {
         Component component = super.getTableCellEditorComponent
              (table, value, isSelected, r, c);
         JTree t = getTree();
         boolean rv = t.isRootVisible();
         int offsetRow = rv ? r : r - 1;
         Rectangle bounds = t.getRowBounds(offsetRow);
         int offset = bounds.x;
         TreeCellRenderer tcr = t.getCellRenderer();
         if (tcr instanceof DefaultTreeCellRenderer) {
              Object node = t.getPathForRow(offsetRow).
              getLastPathComponent();
              Icon icon;
              if (t.getModel().isLeaf(node))
              icon = ((DefaultTreeCellRenderer)tcr).getLeafIcon();
              else if (tree.isExpanded(offsetRow))
              icon = ((DefaultTreeCellRenderer)tcr).getOpenIcon();
              else
              icon = ((DefaultTreeCellRenderer)tcr).getClosedIcon();
              if (icon != null) {
              offset += ((DefaultTreeCellRenderer)tcr).getIconTextGap() +
                   icon.getIconWidth();
         ((TreeTableTextField)getComponent()).offset = offset;
         return component;
         * This is overridden to forward the event to the tree. This will
         * return true if the click count >= 3, or the event is null.
         public boolean isCellEditable(EventObject e) {
         if (e instanceof MouseEvent) {
              MouseEvent me = (MouseEvent)e;
              // If the modifiers are not 0 (or the left mouse button),
    // tree may try and toggle the selection, and table
    // will then try and toggle, resulting in the
    // selection remaining the same. To avoid this, we
    // only dispatch when the modifiers are 0 (or the left mouse
    // button).
              if (me.getModifiers() == 0 ||
    me.getModifiers() == InputEvent.BUTTON1_MASK) {
              for (int counter = getColumnCount() - 1; counter >= 0;
                   counter--) {
                   if (getColumnClass(counter) == TreeTableModel.class) {
                   MouseEvent newME = new MouseEvent
                   (JTreeTable.this.tree, me.getID(),
                        me.getWhen(), me.getModifiers(),
                        me.getX() - getCellRect(0, counter, true).x,
                        me.getY(), me.getClickCount(),
    me.isPopupTrigger());
                   JTreeTable.this.tree.dispatchEvent(newME);
                   break;
              if (me.getClickCount() >= 3) {
              return true;
              return false;
         if (e == null) {
              return true;
         return false;
    * Component used by TreeTableCellEditor. The only thing this does
    * is to override the <code>reshape</code> method, and to ALWAYS
    * make the x location be <code>offset</code>.
    static class TreeTableTextField extends JTextField {
         public int offset;
         public void reshape(int x, int y, int w, int h) {
         int newX = Math.max(x, offset);
         super.reshape(newX, y, w - (newX - x), h);
    * ListToTreeSelectionModelWrapper extends DefaultTreeSelectionModel
    * to listen for changes in the ListSelectionModel it maintains. Once
    * a change in the ListSelectionModel happens, the paths are updated
    * in the DefaultTreeSelectionModel.
    class ListToTreeSelectionModelWrapper extends DefaultTreeSelectionModel {
         /** Set to true when we are updating the ListSelectionModel. */
         protected boolean updatingListSelectionModel;
         public ListToTreeSelectionModelWrapper() {
         super();
         getListSelectionModel().addListSelectionListener
         (createListSelectionListener());
         * Returns the list selection model. ListToTreeSelectionModelWrapper
         * listens for changes to this model and updates the selected paths
         * accordingly.
         ListSelectionModel getListSelectionModel() {
         return listSelectionModel;
         * This is overridden to set <code>updatingListSelectionModel</code>
         * and message super. This is the only place DefaultTreeSelectionModel
         * alters the ListSelectionModel.
         public void resetRowSelection() {
         if(!updatingListSelectionModel) {
              updatingListSelectionModel = true;
              try {
              super.resetRowSelection();
              finally {
              updatingListSelectionModel = false;
         // Notice how we don't message super if
         // updatingListSelectionModel is true. If
         // updatingListSelectionModel is true, it implies the
         // ListSelectionModel has already been updated and the
         // paths are the only thing that needs to be updated.
         * Creates and returns an instance of ListSelectionHandler.
         protected ListSelectionListener createListSelectionListener() {
         return new ListSelectionHandler();
         * If <code>updatingListSelectionModel</code> is false, this will
         * reset the selected paths from the selected rows in the list
         * selection model.
         protected void updateSelectedPathsFromSelectedRows() {
         if(!updatingListSelectionModel) {
              updatingListSelectionModel = true;
              try {
              // This is way expensive, ListSelectionModel needs an
              // enumerator for iterating.
              int min = listSelectionModel.getMinSelectionIndex();
              int max = listSelectionModel.getMaxSelectionIndex();
              clearSelection();
              if(min != -1 && max != -1) {
                   for(int counter = min; counter <= max; counter++) {
                   if(listSelectionModel.isSelectedIndex(counter)) {
                        TreePath selPath = tree.getPathForRow
                        (counter);
                        if(selPath != null) {
                        addSelectionPath(selPath);
              finally {
              updatingListSelectionModel = false;
         * Class responsible for calling updateSelectedPathsFromSelectedRows
         * when the selection of the list changse.
         class ListSelectionHandler implements ListSelectionListener {
         public void valueChanged(ListSelectionEvent e) {
              updateSelectedPathsFromSelectedRows();

  • How to make JComboBoxes transparent

    For some reason "setOpaque(false)" doesn't seem to work for JComboBoxes. I'm using java 1.4
    Below is some code. If you compile and run it you should get a window with a button and a combo box, the button is transparent, the combo box is not.
    import javax.swing.*;
    import java.awt.*;
    import java.awt.geom.Area;
    * test transparent swing components
    class TransTest
    public static void main(String args[])
         JFrame theFrame = new JFrame("transparency test");
         JComponent contentPane = new JComponent()
              public void paint(Graphics g)
              Graphics2D g2 = (Graphics2D)g;
              Area s = new Area((Shape)new Rectangle(0, 0, getWidth(), getHeight()));
              g2.setPaint(new GradientPaint(0f, 0f, Color.GRAY, 150f, 100f, Color.WHITE, true));
              g2.fill(s);
              super.paintChildren(g);
         theFrame.setContentPane(contentPane);
         theFrame.setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
         JButton button = new JButton("button");
         button.setOpaque(false);          // this works
         JComboBox combo = new JComboBox();
         combo.addItem("combo");
         combo.setOpaque(false);               // this doesn't seem to work
         JPanel pnl = new JPanel();
         pnl.setOpaque(false);
         pnl.add(button);
         pnl.add(combo);
         contentPane.setLayout(new BorderLayout());
         contentPane.add(pnl, BorderLayout.CENTER);
         theFrame.pack();
         theFrame.setVisible(true);

    Try setOpaque(true) and setBackground(new Color(r,g,b,a)) where r, g and b are respectively the values of red, green and blue and a the alpha value (0 means totaly transparent, 255 totaly opaque). Sometimes a component should be opaque with a transparent background to make the transcparency works.
    But I have to ask you a question : have you bugs with the display ? Indeed, I made an app that doesn't use a gradient paint like you, but the JFrame have a ContentPane that display a picture. I made every JComponent transparent in order to see the background picture. The display is very dirty with JButton, JTextArea, JTextField and JList. Indeed, when moving cursor over JButton, the JButton displays the top lecft corner of the JFrame instead of the underlaying part of the picture as expected with transparency. With JTextField and JTextArea, when typing text the same problem occured. With JList, the problem appear when scrolling. only a full update(Graphics g) can clean the display, that is I must call it with every mouseMoved, mouseClicked, etc. events. The problem appears only with JDK > 1.2.2 (JDK1.3 and later)

  • Spherical Photo Gallery how to make a transparent background

    http://www.flashandmath.com/flashcs4/spheregallery/index.html
    http://www.flashandmath.com/flashcs4/spheregallery/spherical_gallery.zip
    I am pretty new to the world of flash, a flash newbie.
    Please check link above my question is related to making this sphere gallery.
    I am trying to make the background transparent, and i can , when i make it transparent
    the navigation for the sphere doesnt let me navigate throught the pictures.
    If you look at the code i made it transparent by removing the drawboard function or the fills in the function.
    As i said when i do this the navigation seems non functional.
    if download link does not work try the other at the top.

    Hi,
    Since you had written event handlers on 'board' and board is transparent (without drawBoard function), there will be no events triggered and navigation is not possible. Workaround is to create board with fill = minimum alpha value (0.01).
    board.graphics.beginFill(0x0, 0.01);
    Let me know if you need more information.
    Regards,
    Karthikeyan R.

  • How to make a transparent java applet?

    is it possible to make a transparent applet?

    No. But consider making the applet paint a background that matches (in colour and texture) the background of the web page in which it's being displayed.

  • How to make JFrame scrollable?

    How can I make a JFrame scrollable? So that when I resize the JFrame to a smaller size the contents remain accessible? The way it is now is that when I resize a JFrame I can't access the components that fall out of the window (I'm using absolute component positioning within the JFrame). I thought adding two scrollbars to take care of this would be easy, but so far I haven't been able to get it right. Any suggestions would be appreciated.

    Why dont you put all your components in a JPanel, add a scrollpane to it and then add that JPanel to
    ur JFrame.
    += KRR

  • How to make a transparent header?

    Hello everyone,
    Im a beginner in photoshop, so excuse me if this is not a very smart question.
    I did a bit of editing with the header on the site http://www.amazingplacelist.com but i want to make the header a little bit transparant.
    Is this possible and how do i achieve this/wich settings do i use in photoshop?
    thank you!

    Hi there
    It would be helpful if you could post a screenshot of your layers panel if that is possible. However, I've posted a few tips below on using opacity with layers.
    Below is the layers panel for my re-creation of your image. It may not look similar to your layers panel, but if you'd like, I can provide instructions for how I created my image. Essentially, I have a colored background layer, the island image with an opacity mask, and a basic text layer.
    To change the opacity of the island, click on the thumbnail of the image in your layers panel. In the top right area of the layers panel (shown below), there should be a slider labeled "Opacity". This will allow you to change the transparency of the image.
    Now, since you're using this image on a website, it will be helpful to use Photoshop's Save for Web function. Choose File > Save for Web... from the menu bar.
    This function will allow you to save images for use on the web, and will also allow you to preserve any transparency. Note that below I've selected PNG as my file type and checked the box for "Preserve transparency".
    I hope this helped you out, if you need additional explanations or instructions, please don't hesitate to ask
    Good luck!

  • How to make JFrame become the topmost window?

    I have server that is supposed to show a TOPMOST JFrame window each time it gets a "Show Window" command from client. I use JFrame to create and show the window in the server code:               
    JFrame mainWin = new JFrame();
    mainWin.setResizable( false );
    Container mainContainer = mainWin.getContentPane();
    mainContainer.setLayout( null );
    // add components to mainContainer
    mainWin.setVisible( true );
    mainWin.show();
    mainWin.toFront();
    If I run the server under windows platform, the first created JFrame window is always hiding behind under other application windows. However, the JFrame windows other than the 1st one are always at top.
    The BAD thing is, if I run the server under Macintosh platform, the JFrame windows are always hiding behind the other application windows.
    Does anyone know how to fix the problem? i.e., making the JFrame window appear on top of other windows under any platforms?
    Thanks.
    ZZ
    p.s. I am using JDK version is 1.3.0.

    there is some weirdness with java I've noticed under windows during development. When you start the app from a console window or script, if you change focus to another window before the first java window shows up, it will show up behind the window you changed focus to. If you leave it alone until the window shows, it will be on top. A work around is after you call show(), call toFront().

  • How to make image transparent to background in Web Dynpro...

    Hi Experts,
    IN our web dynpro application, we need to have some fonts and sizes of texts to be displayed on the layout. Since web dynpro has limited options for the design and color of a Textview, we have decided to use the image instead.
    This image has exactly the same background color as that of web dynpro and is matching perfectly.
    But the problem is, it shows a border surrounding the image. We need to remove that border and make it completely transparent to the web dynpro background.
    I have tried different design options for Image element but it did not worked.
    Has anyone done this earlier..
    Regards,
    Anand

    Thanks Nitesh,
    I have downloaded the MIME image and it doesn't appear to have the border. This border is added by web dynpro application itself.
    Regards,
    Anand

  • How to make JFrame default Maximum size state?

    Hi all,
    Is there any one know how to construct a JFrame that setMaximum when screen show?
    another word mean the JFrame in Maximum state byb default.
    regards,
    elvis
    scjp

    Pheeeewww...
    Don't people ever search the forum and read older posts?
    Both the question and the partly wrong answer have appeared many, many times before.
    In pre-1.4 Java you simply cannot maximize a frame.
    The 'solution' is probably the best you can do, but it does not really maximize the frame:
    * The user can still move/resize it.
    * It does not take into account the size/position of the windows task bar or any other window manager palette windows.
    There also has been a solution that uses the Robot class to simulate a click on the maximize button, but that's a real dirty trick, that won't work in applets and strongly depends on the exact layout of the window's decorations.
    In Merlin you can programatically maximize a frame as well as find out the screen's insets (resulting from the task bar...)
    Stephen

  • How to make JFrame positioned to lower right corner of user's desktop

    I'm a new java user, and I'm working on building a small
    application. When the application is launched, I would
    like the application (JFrame) window to be positioned
    in the lower right corner of the user's desktop. Does
    anyone know how to get the user's desktop size so
    I can position the application.
    Here is a code snippet where I lauch the app.
    public static void main(String args[]) {
    ArchiveRestore mainFrame = new ArchiveRestore();
    mainFrame.setSize(500, 500);
    mainFrame.setTitle("Master Model Automation");
    mainFrame.setVisible(true);
    Thanks
    -cliff

    Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize();
    Will get the screen size. The Toolkit class is in the java.awt package.

  • How to make JFrame window un-resizable?

    I create a window using JFrame. I don't want user to re-size the window. How can I do that? Thanks!

    JFrame f = new JFrame();
    f.setResizable(false);
    Jframe entends frame
    setResizable() is a method in frame
    http://java.sun.com/j2se/1.4.2/docs/api/java/awt/Frame.html#setResizable(boolean)

  • How to make a transparent background in a PNG file

    I would like to make a PNG image with a transparent background instead of the white background. See this link for the image:
    http://www.drifterandthegypsy.com/wp-content/uploads/2012/11/lookatthebrightside_11.jpg
    I have a very old Photoshop program Photoshop 7.
    I tried clicking on Save for Web and selecting PNG-24 and checking the transparent box but it didnt work.

    Hi,
    Try something like the following:
    (click on the screenshots below for larger views)
    1. Select the Magic Wand and set the same settings in the tool options bar as shown below.
        Click on the white area outside the yellow circle with the magic wand tool.
    2. Go to Select>Modify>Expand and enter 1
    3. Go to Edit>Cut
    4. Go to Image>Trim and check Transparent Pixels
    5. Go to File>Save For Web and choose PNG-24 with Transparency checked

  • How to make JFrame Always on Top?

    is it possible to make a JFrame always stay on top???
    anyway article or tutorial on this??
    thx

    Why not use the search facility before posting a question?????
    I used "always on top" (keywords taken from your topic) and found plenty of advice.

Maybe you are looking for