Originally posted by Dave Donohoe:
Hi all - can anyone tell me the easiest way to add a Right Click Popup Menu onto the items in a JList?
Thanks,
D
Originally posted by wasif akbar:
The application I working on allows you to parse thru xml files. It looks for certain tags within the xmls and then writes out the value for the "Name" attribute of that tag to a file. On my gui, I have a textfield, a textarea and two buttons, one button to browse for the xml file and one called parse. When I parse, all of objects that I am parsing for get written to a file that is created. Basically what I want is for the user to be able view the contents of the file as it is being generated or as soon as it is generated in the textarea on my gui. What I don't want to do is create another button called "View File" and then when you click on it, the file gets opened in the textarea. I want the contents to be displayed in the textarea as soon as the file has been parsed or while it is being parsed.
Any help would be great. Sample code would be even better. The gui is mostly awt components except for the filechooser when I browse.
Originally posted by tom tran:
Hi,
I am writing a Java app (thick app) and I'd like to send
files to a web server using HTTP protocol. If you know how
to do it, I would very much appreciate if you can tell me.
I already have an example of sending files using ftp but
what I want to use is HTTP since the requirement of communication
is HTTP.
Thanks in advance,
Tom Tran
trant@onr.navy.mil
Originally posted by Andrew Hoffman:
I can run this as an applet but not as an application. Can someone help make this program do either or?
import java.applet.*;
import java.awt.BorderLayout;
import java.awt.*;
import javax.swing.*;
import java.awt.event.*;
import java.util.*;
import Chapter8.MyFrameWithExitHandling;
public class Lab14_1 extends JApplet implements ActionListener
{
// Delcare Audio Files
static AudioClip playAudio;
protected AudioClip loopAudio;
protected AudioClip stopAudio;
// Declare Buttons
private JButton jplay = new JButton("PLAY");
private JButton jloop = new JButton("LOOP");
private JButton jstop = new JButton("STOP");
private boolean isStandalone = false;
public static void main(String [] args)
{
// Create a frame
MyFrameWithExitHandling frame = new MyFrameWithExitHandling(
"Lab14_1 Application");
// Crate an instance of the applet
Lab14_1 applet = new Lab14_1();
applet.isStandalone = true;
// Add the applet instance to the frame
frame.getContentPane().add(applet, BorderLayout.CENTER);
// Invoke init() and start()
applet.init();
applet.start();
// Display the frame
frame.pack();
frame.center();
frame.setVisible(true);
}
public void init()
{
if (!isStandalone)
{
JPanel p = new JPanel();
p.setLayout(new FlowLayout());
p.add(jplay);
p.add(jloop);
p.add(jstop);
getContentPane().add(p);
// Create audio clips for playAudio, loopAudio
playAudio = getAudioClip(getCodeBase(),
"Chapter14/Airplane.wav");
loopAudio = getAudioClip(getCodeBase(),
"Chapter14/Chimp.wav");
// Register Listeners
jplay.addActionListener(this);
jloop.addActionListener(this);
jstop.addActionListener(this);
}
}
public void actionPerformed(ActionEvent e)
{
if (e.getSource() == jplay)
{
playAudio.play();
}
if (e.getSource() == jloop)
{
loopAudio.loop();
}
if (e.getSource() == jstop)
{
playAudio.stop();
loopAudio.stop();
}
}
}
Originally posted by anukampa malhi:
you are correct that i shd u use JTextPane but i m not able to get how can i actually use it. I have spend almost 3 days to work thru JTextPane but of no use. Can u please help me in same.
Thanx
Anukampa
Originally posted by Felix Devasia:
Hi,
Can anyone tell me how I could get rid of the default titlebar of the frame while running swing applications? Also, can I change the default icin of the "teacup", in the upperleft corner of the titlebar?
thanks..
Originally posted by Sergei Voropay:
I'm working on an applet derived from JApplet class. When running the applet in browser and scrolling the page in any direction, the applet flickers. Is there a way of getting rid of this annoying behavior?
Originally posted by James Lechte:
Hi all,
im trying to extend basic design of a console based system to a gui interface. I am having a problem with an array within an 'Account' class which stores details and amounts of accounts. The problem is: when i try and tie up the class which builds up the interface, panels, panes, container etc. to the 'Account' class it cannot pass the info properly. I have looked at numerous examples of swing and AWT but cannot see examples of pluggin in other classes!
please any advice would help!
Cheers James
Originally posted by Skantha Kandiah:
Hi,
I am trying to create an application that can display different images in a single frame. The main frame contains a JScrollPane that contains a JPanel. Initally there is no image on the JPanel and there are no scrollbars on the scroll pane. When I add a large image to the JPanel the scrollbars don't appear on the scroll pane. What function do I need to call for the scroll bars to appear? I tried revalidate() and it did not work.
Thanks,
SK
Originally posted by rajesh purohit:
Hi
We have vertical and horizontal AWT scroll bars in out applet. We are trying to capture the mouse clicked and released events on that component. But the component generates only pressed, entered and exited events. But the right mouse button generates clicked and released events (weird!!). Is there any way to fix this sothat the left mouse button generates the clicked and released events?
Any help would be appreciated.
Thanks
Rajesh Purohit