The Artima Developer Community
Sponsored Link

Java Answers Forum
How to set the icon of the frame create by float JToolbar

1 reply on 1 page. Most recent reply: Jul 1, 2002 9:48 AM by Charles Bell

Welcome Guest
  Sign In

Go back to the topic listing  Back to Topic List Click to reply to this topic  Reply to this Topic Click to search messages in this forum  Search Forum Click for a threaded view of the topic  Threaded View   
Previous Topic   Next Topic
Flat View: This topic has 1 reply on 1 page
chinthaka

Posts: 1
Nickname: chin
Registered: Jul, 2002

How to set the icon of the frame create by float JToolbar Posted: Jun 30, 2002 11:16 PM
Reply to this message Reply
Advertisement
When I drag a floatable JToolBar out from the its implemented JFrame it will be on a seperate container( JFrame).but this JFrame doesn't have the same Icon that JToolbar previously placed.It getsthe java defult coffee cup icon.
How do I set the Icon of this floated JToolbars frame as same as parent ToolBar frame ?


Charles Bell

Posts: 519
Nickname: charles
Registered: Feb, 2002

Re: How to set the icon of the frame create by float JToolbar Posted: Jul 1, 2002 9:48 AM
Reply to this message Reply

/* FloatingToolBar.java
* @author: Charles Bell
* @version: July 1, 2002
*/

import java.awt.*;
import javax.swing.*;

/*
*/
public class FloatingToolBar extends JFrame{
public FloatingToolBar(){
super("FloatingToolBar");
init();
}

public static void main(String[] args){
new FloatingToolBar();
}

public void init(){
setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
setIconImage(new ImageIcon("earth.jpg").getImage());
JToolBar toolbar = new JToolBar("Floating Tool Bar", SwingConstants.HORIZONTAL);
toolbar.setFloatable(true);
toolbar.add(new JLabel(new ImageIcon(getIconImage().getScaledInstance(25,25,Image.SCALE_DEFAULT))));
toolbar.add(new JButton("Dummy"));

getContentPane().add(toolbar,BorderLayout.NORTH);

JTextArea display = new JTextArea(20,50);
JScrollPane scrollpane = new JScrollPane(display);
getContentPane().add(scrollpane,BorderLayout.CENTER);

pack();
setLocationRelativeTo(null);
show();
}
}

Flat View: This topic has 1 reply on 1 page
Topic: cannot resolve symbol Previous Topic   Next Topic Topic: convert long[] to String and again to String to long[]

Sponsored Links



Google
  Web Artima.com   

Copyright © 1996-2019 Artima, Inc. All Rights Reserved. - Privacy Policy - Terms of Use