Display Applet in Jsplitpane of another class


There is one java file in which one applet is created. there is one more file
which extends Jpanel, it is divided into 2 frames using JsplitPane. on left hand side
it displays Treeview and on right hand side it shows html pages as per the node selection.
but i want to display applet created in other package.and uses f1j component to display
spreadsheet.
so how can i use this applet to display onright hand side on the selection of perticular nade.
please help me its urgent.
thanks in advance.
Posted On: Tuesday 23rd of October 2012 11:34:00 PM Total Views:  238
View Complete with Replies

RELATED TOPICS OF Swing / AWT / SWT PROGRAMMING LANGUAGE




How to display Database Table DATA in jTable

Hi! I have a Swing GUI program where I have to display Database table data in jTable. any advices would be appreciated..
VIEWS ON THIS POST

59

Posted on:

Monday 22nd October 2012
View Replies!

Help me display array of JButtons properly

Hi all... Im new to swing and I have a 2d array of JButtons...I'm trying to loop through the array and add them to the container but I dont understand how the layout managers work.So my 20x20 grid is being displayed something like 26x11...Could anyone provide a quick fix for the following code private static Tile[][] allTiles=new Tile[20][20] ; Container c=two.getContentPane();//two is a JPanel cont.setLayout(new GridLayout(20,20)); for(Tile[] tile :allTiles) { for(Tile t:tile) { two.add(t.tileButton); } }
VIEWS ON THIS POST

121

Posted on:

Monday 22nd October 2012
View Replies!

Capture screenshot of a widget without displaying it

. I want capture screenshot of a widget[SWT](for example, a button, a panel or a browser) without displaying it on the screen, and save the screenshot as a file. Does anyone have any ideas
VIEWS ON THIS POST

109

Posted on:

Monday 22nd October 2012
View Replies!

trouble displaying ImageIcon

I have a piece of code from a book I'm working with. I haven't adjusted the code at all and so am surprised that it isn't working properly out of the box. import java.awt.*; import java.awt.event.*; import javax.swing.*; public class jlabel { static JFrame frame = new JFrame("Example"); public static void main(String[] args) { ImageIcon icon = new ImageIcon("star.gif"); JLabel jl = new JLabel("You are a star", icon, JLabel.CENTER); frame.setSize(400,100); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); frame.setLayout( new FlowLayout() ); frame.add( jl ); frame.pack(); // size the JFrame to fit its contents // frame.getContentPane().add( jl ); frame.setVisible(true); } }
VIEWS ON THIS POST

86

Posted on:

Monday 22nd October 2012
View Replies!

display contents of a text file in a new window

I am trying to display teh contents of a text file in a new window Can anyone please suggest on htis
VIEWS ON THIS POST

81

Posted on:

Monday 22nd October 2012
View Replies!

Image is not getting displayed

I want to display an image in the applet..Can anyone say me how to do that..And i want to display the label at specified co-ordinates..How can i do this.. package mining; import javax.swing.*; import java.awt.*; import javax.swing.border.LineBorder; /** * * @author 8563 */ public class Tree extends javax.swing.JApplet { JLabel label; int h = 10; int w = 5; public void init() { Container cont = getContentPane(); JPanel panel = new JPanel() { protected void paintComponent(Graphics g) { // super.paintComponent(g); Graphics2D g2 = (Graphics2D)g; g2.setRenderingHint(RenderingHints.KEY_ANTIALIASING,RenderingHints.VALUE_ANTIALIAS_ON); Image img = Toolkit.getDefaultToolkit().getImage("image.gif"); g.drawImage(img,20,20,this); g2.drawString(" etrett",45,45); h = img.getHeight(this); w= img.getWidth(this); label = new JLabel(); label.setLocation(30,30); } }; cont.setLayout(new BorderLayout()); panel.setLayout(new BorderLayout()); cont.add(panel,BorderLayout.CENTER); panel.setBorder( new LineBorder(Color.BLACK)); //panel.setBorder(BorderFactory.createEmptyBorder()); panel.setVisible(true); cont.setVisible(true); } }
VIEWS ON THIS POST

69

Posted on:

Monday 22nd October 2012
View Replies!

display JFileChooser icon running a jar

Hi! If I run my application in Eclipse (or however in a development environment) the JFileChooser icon appears, but if I pack my application in a jar (throught Ant) and run it , the icon doesn't appear.... Any ideas
VIEWS ON THIS POST

70

Posted on:

Monday 22nd October 2012
View Replies!

How to display an image in the background of a JTable with customized rendrer?

I am working on one desktop application. I have JTable displayed on top of the Scroll Pane. Now the requirement is to display company logo in the background. I am using customized rendrer to display the non editable columns in grey etc.. So how can I display the image in the background
VIEWS ON THIS POST

106

Posted on:

Monday 22nd October 2012
View Replies!

Image display with visor

, I have a application that shows a pgm image read it of a file. When I read the image, I show two frames, one with the original size (with scrolls) ant another with the same image but with a smaller size. In this second frame I have to draw a litttle square that represents the zone of the image diplayed on the frame with the original size. I display the image, assign it to a label, and run's ok. To draw a square I think I have to use canvas \t, but when I draw the square, the label with the image disappear from the frame. I think I've made something wrong, can somebody help me any advice will be welcome. Thank's for all, and sorry for my English.
VIEWS ON THIS POST

65

Posted on:

Monday 22nd October 2012
View Replies!

JButton is not displaying the background color

Hi , I have a JButton that pops up the color chooser on click and changes its background color when a new color is selected. This works fine unless I change the LookAndFeel of the dialog containing the button as follows. UIManager.setLookAndFeel(new WindowsLookAndFeel()); When the LookAndFeel is set, it appears like the button is on a panel, and the panel is changing its background color. I understand that on WindowsLookAndFeel a gradient is drawn on top of the button to display that 3D look which is why the background color is not being shown. Just wondering if there is a work around for this.
VIEWS ON THIS POST

93

Posted on:

Monday 22nd October 2012
View Replies!

Help w/ displaying several .PNG files

I am very new to Java, and I am trying to make a graphical Craps game. If you're familiar with Craps, then you know that there are about 40 different bets meaning there are 40 different places to put poker chips on the table. I'd like to show a poker chip on every bet location on the table where the player has actually placed a bet. The best approach I can come up with so far is to: 1. Make 40 extended JPanel inner classes (inner to the actual extended JFrame class) 2. Override the paintComponent() method for each panel 3. Use the drawImage() method to paint the picture on the panel 4. Add every panel to the frame. Then, as the user wins, loses, or places bets, I can turn the visibility off or on for the panels as needed. The only other approach I can think of is constructing and destroying the panels as needed for each chip shown. I'm hoping there's a way to just say "if... show x picture at this location" and "if... remove x picture". Am I way off track here Is there a better way Please help.
VIEWS ON THIS POST

68

Posted on:

Tuesday 23rd October 2012
View Replies!

Blank Frame being displayed

I write a class extending JFrame. I add text boxes to it in the constructor. Now I instantiate the class and set it visible. This works fine in Windows 2k but when I use Windows XP the frame comes up blank. On maximising and minimizing or just moving it across the screen , the text boxes are displayed. I try repaint(), validate() and setting java option to -Dsun.java2d.d3d=false, but in vain . Can anyone please help me out in this regard.
VIEWS ON THIS POST

54

Posted on:

Tuesday 23rd October 2012
View Replies!

Posting it again (Urgent!) Can't display chinese and japanese font at the same time

The following program tries to display a string that contains mostly japanese characters along with few chinese characters. When I try "java I18NTest zh ZH" it shows all japanese and chinese characters properly except one. When I try "java I18NTest ja JA" its shows the japanese fine but messes up the chinese characters. What do I have to do so that it displays all japanese and chinese characters properly Following is the java code and the .properties files (both the properties files are same though). I'm sure that the problem has nothing to do with system fonts as there is a third party java application that shows those characters properly on my machine. Any help will really be appreciated.
VIEWS ON THIS POST

100

Posted on:

Tuesday 23rd October 2012
View Replies!

Can't display chinese and japanese at the same time (Urgent!!!!)

Ok, the following program tries to display a string that contains mostly japanese characters along with few chinese characters. When I try "java I18NTest zh ZH" it shows all japanese and chinese characters properly except one. When I try "java I18NTest ja JA" its shows the japanese fine but messes up the chinese characters. What do I have to do so that it displays all japanese and chinese characters properly Following is the java code and the .properties files (both the properties files are same though). I'm sure that the problem has nothing to do with system fonts as there is a third party java application that shows those characters properly on my machine. Any help will really be appreciated.
VIEWS ON THIS POST

74

Posted on:

Tuesday 23rd October 2012
View Replies!

Container not displaying.

Ive cut and pastethis and tried to make a calculator display. What have I done wrong // GUI to display the cards, will have 7 panels and two cards in each panel. import java.awt.*; import java.awt.event.*; import javax.swing.*; public class cardGUI implements ItemListener { JPanel cards; //a panel that uses CardLayout final static String ENGLISHPANEL = "JPanel with English"; final static String SLOVAKPANEL = "JPanel with Slovak"; // set up the cards in a content pane public void addComponentToPane(Container pane) { //Put the JComboBox in a JPanel to get a nicer look. JPanel comboBoxPane = new JPanel(); //use FlowLayout String comboBoxItems[] = { ENGLISHPANEL, SLOVAKPANEL }; JComboBox cb = new JComboBox(comboBoxItems); cb.setEditable(false); cb.addItemListener(this); comboBoxPane.add(cb); //Create the "cards". JPanel card1 = new JPanel(); card1.add(new JButton("Try")); card1.add(new JButton("Next")); card1.add(new JTextField("TextField", 20)); JPanel card2 = new JPanel(); card2.add(new JLabel("English Word")); //Create the panel that contains the "cards". cards = new JPanel(new CardLayout()); cards.add(card1, ENGLISHPANEL); cards.add(card2, SLOVAKPANEL ); pane.add(comboBoxPane, BorderLayout.PAGE_START); pane.add(cards, BorderLayout.CENTER); } /// when only above code present thiswont complile because an interface is expected, why public void itemStateChanged(ItemEvent evt) { CardLayout cl = (CardLayout)(cards.getLayout()); cl.show(cards, (String)evt.getItem()); } /// when only above code present thiswont complile because an interface is // expected, why No brackets /** * Create the GUI and show it. For thread safety, * this method should be invoked from the * event-dispatching thread. */ private static void createAndShowcardGUI() { //Make sure we have nice window decorations. JFrame.setDefaultLookAndFeelDecorated(true); //Create and set up the window. JFrame frame = new JFrame("Card GUI"); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); //Create and set up the content pane. cardGUI demo = new cardGUI(); demo.addComponentToPane(frame.getContentPane()); //Display the window. frame.pack(); frame.setVisible(true); } public static void main(String[] args) { //Schedule a job for the event-dispatching thread: //creating and showing this application's GUI. javax.swing.SwingUtilities.invokeLater(new Runnable() { public void run() { createAndShowcardGUI(); } }); } }
VIEWS ON THIS POST

58

Posted on:

Tuesday 23rd October 2012
View Replies!

Dialogs windows not displaying properly

I have a swing app which has a JFrame for a main container on this frame are several components (table, buttons etc). Several of the buttons cause dialog windows to open. One button opens another JFrame (was a separate app, but is now a pop up window in this app). The problem is after pushing the button for that opens this new window (and closing it) the other dialog windows won't paint correctly. Originally the main window wouldn't repaint correctly but I fixed this by passing its frame to the other frame and calling its update method when the secondary/child frame closed. I've looked through the archives here and must not have worded my search properly b/c I can't find much. Is there a tutorial online somewhere about the proper way to deal with multiple windows/frames and the repainting issues with them -Tad
VIEWS ON THIS POST

78

Posted on:

Tuesday 23rd October 2012
View Replies!

Help Graphic is not displaying!

I have a jcomponent for which I have overwritten the paintComponent() method. In this method, I am drawing images in a variety of places. This jcomponent is also an observer to another object that is deciding where images should be plotted. In my update() method, I have verified that I am catching the event that is saying a new image has been plotted. I have also verified that I am calling revalidate(), repaint() and I've even tried updateUI() and lots of other things. However, my paintComponent() method is NOT being called and this is a problem. One other thing I have tried is to call paintComponent() directly - paintComponent(getGraphics()). This calls my paintComponent() method and I have verified that it is calling drawImage() at the appropriate location. However, the image that is supposed to be being drawn is STILL NOT showing up. Any ideas\t I'm at a total loss...
VIEWS ON THIS POST

72

Posted on:

Tuesday 23rd October 2012
View Replies!

Ghosting of a JTable display

I was wondering if anyone can tell me how this can happen: It does not happen all the time and I can not figure out how to make it happen on demand. I have a thread that tries to update the table from a database query every 10 seconds if there are new entries in the database. If there are new values available, a runnable is created to do the job of adding them to the JTable with the invokeLater method. the while, the user is able to scroll around and click on rows in the table. I would like to stamp out the problem once and for all but am at a bit of a loss to figure out where it could be coming from. Especially when it happens so rarely. Can anyone shed any light on this for me Cheers, Jared.
VIEWS ON THIS POST

81

Posted on:

Tuesday 23rd October 2012
View Replies!

Problem in displaying JTable multiline headers with icons in jdk1.2

Hi all, I am trying to display icons for JTable headers which are single line & multiline headers. When a header is clicked the icon is added to a vector. Then the header text is checked for single line & multiline text & then even this text is added to the same vector. Then by using the setListData(vector) & by using a ListCellRenderer for a JLabel this is being changed to a JLabel & is then displayed. But the problem is that for single line headers the icon & the text string appear in the same line & therefore the whole text is not visible. The second problem is that for multiline headers the icon in the vector is being replaced by the header text & it only displays the normal multiline header without the icon. Well the same code works perfectly fine with jdk1.4 & now I want the same thing for jdk1.2. For jdk1.4 the icon appears below the text string by default. Can anyone please tell me where the problem is. Has the ListCellRenderer changed for these 2 jdk versions\t Please suggest me how do I proceed with this problem. Any help will be highly appreciated. Thanx.
VIEWS ON THIS POST

135

Posted on:

Tuesday 23rd October 2012
View Replies!

Newbie, Please Help: Why can I not get the numbers to display

I have to write a program that shows three stations that collect numerical data for rainfall. I suppose to be able to put the number in and click enter and the number will show up in the box beside the input box. Then the input box goes back to 0.0, and anytime I add a number to it, it totals to the box on the right. What am I doing wrong Please help. I am running out of time. Here is the program I have written so far. import java.awt.*; import java.awt.event.*; import javax.swing.*; public class FinalProject extends JFrame implements ActionListener { public static final int WIDTH = 550; public static final int HEIGHT = 100; private JTextField myNumberOut1; private JTextField myNumberIn1; private double sum=0; public FinalProject() { super("Eric Luce's Final Project"); setSize(WIDTH, HEIGHT); /** Setting Labels 1-3 for Stations */ JLabel myLabel1 = new JLabel ("Station Austin:"); JLabel myLabel2 = new JLabel ("Station Amherst:"); JLabel myLabel3 = new JLabel ("Station LaCrosse:"); /** Setting Buttons 1-3 for Adding NumberIn */ JButton myButton1 = new JButton ("Enter"); myButton1.addActionListener(this); myButton1.setBackground(Color.RED); JButton myButton2 = new JButton ("Enter"); myButton2.addActionListener(this); myButton2.setBackground(Color.WHITE); JButton myButton3 = new JButton ("Enter"); myButton3.addActionListener(this); myButton3.setBackground(Color.BLUE); /** Setting Labels 4-6 for Rain Fall totals */ JLabel myLabel4 = new JLabel ("Total Rainfall:"); JLabel myLabel5 = new JLabel ("Total Rainfall:"); JLabel myLabel6 = new JLabel ("Total Rainfall:"); /** Setting Text fields for NumberIn */ JTextField myNumberIn1 = new JTextField ("0.0", 10); JTextField myNumberIn2 = new JTextField ("0.0",10); JTextField myNumberIn3 = new JTextField ("0.0", 10); /** Setting Text fields for NumbersOut */ JTextField myNumberOut1 = new JTextField (); JTextField myNumberOut2 = new JTextField (); JTextField myNumberOut3 = new JTextField (); /** Adding contents to frame line 1 */ getContentPane().add(myLabel1); getContentPane().add(myNumberIn1); getContentPane().add(myButton1); getContentPane().add(myLabel4); getContentPane().add(myNumberOut1); /** Adding contents to frame line 2 */ getContentPane().add(myLabel2); getContentPane().add(myNumberIn2); getContentPane().add(myButton2); getContentPane().add(myLabel5); getContentPane().add(myNumberOut2); /** Adding contents to frame line 3 */ getContentPane().add(myLabel3); getContentPane().add(myNumberIn3); getContentPane().add(myButton3); getContentPane().add(myLabel6); getContentPane().add(myNumberOut3); Container contentPane = getContentPane(); contentPane.setBackground(Color.LIGHT_GRAY); contentPane.setLayout(new GridLayout(3, 5)); this.addWindowListener (new WindowAdapter(){ public void windowClosing(WindowEvent e){ } }); } public static void main (String[] args){ FinalProject mainFrame = new FinalProject(); mainFrame.setVisible(true); } public void actionPerformed(ActionEvent e){ { Container contentPane = getContentPane(); if (e.getActionCommand().equals ("ENTER")); contentPane.setBackground(Color.RED); sum = sum + myNumberIn1(); myNumberIn1.setText(Double.toString(sum)); myNumberOut1.setText(Double.toString(sum)); } } private static double stringToDouble(String stringObject) { return Double.parseDouble(stringObject.trim()); } }
VIEWS ON THIS POST

85

Posted on:

Tuesday 23rd October 2012
View Replies!