Can someone help me with my code?
i just want to make the add button add the text in the text field and make the remove button remove an index from the list when clicked but I cant seem to get my code to work. pls help me
thanks in advance!!!
heres my code:
import javax.swing.*;
import java.awt.*;
import java.awt.event.*;
import javax.swing.event.*;
public class TextList2 extends JApplet implements ActionListener {
Container panel;
JTextField text;
JButton buttonAdd;
JButton buttonRemove;
JList list;
DefaultListModel listModel;
GridBagLayout grid = new GridBagLayout();
GridBagConstraints c = new GridBagConstraints();
public void init() {
panel = getContentPane();
panel.setLayout(grid);
text = new JTextField(10);
buttonAdd = new JButton("Add");
buttonAdd.addActionListener(new AddListener());
buttonRemove = new JButton("Remove");
buttonRemove.addActionListener(new RemoveListener());
listModel = new DefaultListModel();
list = new JList(listModel);
listModel.addElement(" ");
list.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
list.setSelectedIndex(0);
list.setVisibleRowCount(10);
list.setSelectionBackground(Color.pink);
JScrollPane listScrollPane = new JScrollPane(list);
c.anchor = GridBagConstraints.NORTH;
c.gridx = 0;
c.gridy = 0;
grid.setConstraints(text,c);
panel.add(text);
c.fill = GridBagConstraints.BOTH;
c.gridx = 0;
c.gridy = 1;
c.weighty = 1;
grid.setConstraints(list,c);
panel.add(listScrollPane);
c.fill = GridBagConstraints.NONE;
c.gridx = 0;
c.gridy = 2;
grid.setConstraints(buttonAdd,c);
panel.add(buttonAdd);
c.gridx = 0;
c.gridy = 3;
grid.setConstraints(buttonRemove,c);
panel.add(buttonRemove);
class AddListener implements ActionListener {
public void actionPerformed(ActionEvent e) {
String x = text.getText();
listModel.addElement(x);
class RemoveListener implements ActionListener {
public void actionPerformed(ActionEvent e) {
int x = list.getSelectedIndex();
listModel.remove(x);
public static void main(String args[]){
JFrame frame = new JFrame();
frame.setVisible(true);
frame.addWindowListener(new WindowAdapter() {
public void windowClosing(WindowEvent e) {
System.exit(0);
TextList2 textList2 = new TextList2();
textList2.init();
frame.getContentPane().add(textList2);
frame.pack();
}
add the method for list
Similar Messages
-
Can someone help me with this code?
Hi all,
I have a Flash component that links to a gallery, and I
understand that I can create buttons to point to multiple
galleries. (waiting too long for support from the suppliers)
The User Guide says that I can use the following to create
the connection:
myThumbnailer2.loadGallery(24);
That won't work, and it says that I need to include it in an
onclipevent. I have no idea what i am doing and I was hoping
someone could tell me what to script to get the text button I
created to run this.
Help would really be appreciated.
HughHi Hugh,
You are right in that you can link to other galleries using
the ID number (but, I assume, only TN2Admin (fCMSPro gallery
document) defined galleries) with the code supplied.
I think this may help - I'm a newbie with actionscript and I
know nothing about Flashloaded so I may be way off beam here,
but....
First define a variable, this will be used in the 'show'
(that's show, not load) gallery element of your code:
var galNum: Number;
Make as many buttons as required to launch a gallery (you say
"each button opening one of several galleries" so I assume you want
1 gallery per button) and give each an instance name.
You then write the relevant code for each button function
(assuming once more that the buttons are in the same frame) using
the instance name (I use a separate layer in the frame to write
actionscript and try not to attach code directly to objects - which
then leads me to say yes you can put all the different buttons code
in one frame)....
myLoadGalBtn1.onRelease = function () {
myThumbnailer2.loadGallery(24);
galNum = 24;
myLoadGalBtn2.onRelease = function () {
myThumbnailer2.loadGallery(25);
galNum = 25;
notice the buttons have different instance names (the 1 &
2 at the end - but you can call them what you like).
Then you can use other code supplied to actually show the
gallery (using the variable generated in each button click). Some
code from Flashloaded will be along the lines of:
myThumbnailer2.showGallery(25);
so my guess is you can replace the actual number with the
variable galNum inside the brackets to use the number generated by
whatever button was pressed, like:
myThumbnailer2.showGallery(galNum);
Cheers
Kol -
Hi folks, can someone help me with my redemption code?
have a creative cloud id made last week.
but in order to install my products I have a redemption code needed but that I can't find anywhere. can someone help me???
Thank youI have a fully companies annual subscription of 69.99 a month.
but I can only download the 30-day trial versions.
and if I want to put on them completely firedamp should I enter a redemption code. could it be that the code later emailed word?
Met vriendelijke groet,
Dave Dros
Van: "hans-g." <[email protected]<mailto:[email protected]>>
Beantwoorden - Aan: "[email protected]<mailto:[email protected]>" <[email protected]<mailto:[email protected]>>
Datum: dinsdag 21 oktober 2014 10:03
Aan: iMac <[email protected]<mailto:[email protected]>>
Onderwerp: Hi folks, can someone help me with my redemption code? have a creative cloud id made last week. but in order to install my products I have a redemption code needed but that I can't find anywhere. can someone help me??? Thank you
Hi folks, can someone help me with my redemption code? have a creative cloud id made last week. but in order to install my products I have a redemption code needed but that I can't find anywhere. can someone help me??? Thank you
created by hans-g.<https://forums.adobe.com/people/hans-g.> in Adobe Creative Cloud - View the full discussion<https://forums.adobe.com/message/6850359#6850359> -
I have an early 2011 MacBook Pro which has been running slow for a while. After looking at responses to similar problems I have downloaded and run EtreCheck. Please can someone help me with what it all means.
Thanks in advance.
EtreCheck version: 1.9.15 (52)
Report generated 19 September 2014 08:07:14 GMT+8
Hardware Information: ?
MacBook Pro (13-inch, Early 2011) (Verified)
MacBook Pro - model: MacBookPro8,1
1 2.3 GHz Intel Core i5 CPU: 2 cores
4 GB RAM
Video Information: ?
Intel HD Graphics 3000 - VRAM: 384 MB
Color LCD 1280 x 800
System Software: ?
OS X 10.9.4 (13E28) - Uptime: 0 days 0:4:29
Disk Information: ?
Hitachi HTS545032B9A302 disk0 : (320.07 GB)
S.M.A.R.T. Status: Verified
EFI (disk0s1) <not mounted>: 209.7 MB
Macintosh HD (disk0s2) / [Startup]: 319.21 GB (147 GB free)
Recovery HD (disk0s3) <not mounted>: 650 MB
MATSHITADVD-R UJ-898
USB Information: ?
Apple Inc. FaceTime HD Camera (Built-in)
Apple Inc. BRCM2070 Hub
Apple Inc. Bluetooth USB Host Controller
Apple Inc. Apple Internal Keyboard / Trackpad
Apple Computer, Inc. IR Receiver
Thunderbolt Information: ?
Apple Inc. thunderbolt_bus
Gatekeeper: ?
Mac App Store and identified developers
Kernel Extensions: ?
[not loaded] com.seagate.driver.PowSecDriverCore (5.2.4 - SDK 10.4) Support
[not loaded] com.seagate.driver.PowSecLeafDriver_10_4 (5.2.4 - SDK 10.4) Support
[not loaded] com.seagate.driver.PowSecLeafDriver_10_5 (5.2.4 - SDK 10.5) Support
[not loaded] com.seagate.driver.SeagateDriveIcons (5.2.4 - SDK 10.4) Support
[loaded] com.sophos.kext.sav (9.1.55 - SDK 10.7) Support
[loaded] com.sophos.nke.swi (9.1.50 - SDK 10.8) Support
Launch Daemons: ?
[loaded] com.adobe.fpsaud.plist Support
[loaded] com.microsoft.office.licensing.helper.plist Support
[running] com.sophos.autoupdate.plist Support
[running] com.sophos.configuration.plist Support
[running] com.sophos.intercheck.plist Support
[running] com.sophos.notification.plist Support
[running] com.sophos.scan.plist Support
[running] com.sophos.sxld.plist Support
[running] com.sophos.webd.plist Support
[running] com.trusteer.rooks.rooksd.plist Support
Launch Agents: ?
[loaded] com.divx.dms.agent.plist Support
[loaded] com.divx.update.agent.plist Support
[running] com.sophos.uiserver.plist Support
[running] com.trusteer.rapport.rapportd.plist Support
User Launch Agents: ?
[loaded] com.adobe.ARM.[...].plist Support
[running] com.amazon.music.plist Support
[loaded] com.google.keystone.agent.plist Support
[not loaded] jp.co.canon.Inkjet_Extended_Survey_Agent.plist Support
User Login Items: ?
iTunesHelper
TomTomHOMERunner
AdobeResourceSynchronizer
Dropbox
Internet Plug-ins: ?
FlashPlayer-10.6: Version: 15.0.0.152 - SDK 10.6 Support
DivX Web Player: Version: 3.2.1.977 - SDK 10.6 Support
AdobePDFViewerNPAPI: Version: 11.0.09 - SDK 10.6 Support
AdobePDFViewer: Version: 11.0.09 - SDK 10.6 Support
Flash Player: Version: 15.0.0.152 - SDK 10.6 Support
EPPEX Plugin: Version: 10.0 Support
Default Browser: Version: 537 - SDK 10.9
OVSHelper: Version: 1.1 Support
QuickTime Plugin: Version: 7.7.3
SharePointBrowserPlugin: Version: 14.4.4 - SDK 10.6 Support
iPhotoPhotocast: Version: 7.0 - SDK 10.7
Safari Extensions: ?
Ultimate
Audio Plug-ins: ?
BluetoothAudioPlugIn: Version: 1.0 - SDK 10.9
AirPlay: Version: 2.0 - SDK 10.9
AppleAVBAudio: Version: 203.2 - SDK 10.9
iSightAudio: Version: 7.7.3 - SDK 10.9
iTunes Plug-ins: ?
Quartz Composer Visualizer: Version: 1.4 - SDK 10.9
3rd Party Preference Panes: ?
Flash Player Support
Perian Support
Trusteer Endpoint Protection Support
Time Machine: ?
Skip System Files: NO
Auto backup: YES
Volumes being backed up:
Macintosh HD: Disk size: 297.29 GB Disk used: 160.38 GB
Destinations:
Data [Network] (Last used)
Total size: 2 TB
Total number of backups: 99
Oldest backup: 2012-04-20 17:05:32 +0000
Last backup: 2014-09-18 23:49:25 +0000
Size of backup disk: Excellent
Backup size 2 TB > (Disk size 297.29 GB X 3)
Time Machine details may not be accurate.
All volumes being backed up may not be listed.
Top Processes by CPU: ?
6% InterCheck
5% iCalExternalSync
3% WindowServer
2% CalendarAgent
2% SystemUIServer
Top Processes by Memory: ?
152 MB SophosScanD
147 MB InterCheck
106 MB SophosAntiVirus
66 MB Dropbox
57 MB com.apple.iTunesLibraryService
Virtual Memory Information: ?
161 MB Free RAM
1.55 GB Active RAM
1.41 GB Inactive RAM
902 MB Wired RAM
611 MB Page-ins
0 B Page-outsUninstall Trusteer software
http://www.trusteer.com/support/uninstalling-rapport-mac-os-x
Remove Sophos
https://discussions.apple.com/message/21069437#21069437 -
Can someone help me with an iCloud problem when I take a picture with my iPhone 4s it some of the times go to my ipad2 but mostly it doesn't can anyone help me out
I'm assuming you have Photo Stream set up of both devices. However, it seems many users are experiencing the same as you - my take is that streaming photos is not foolproof yet.
-
Can somebody help me with this code?
Can anyone help me with this code? My problem is that i can't
seem to position this form, i want to be able to center it
vertically & horizontally in a div either using CSS or any
other means.
<div id="searchbar"><!--Search Bar -->
<div id="searchcart">
<div class="serchcartcont">
<form action='
http://www.romancart.com/search.asp'
name="engine" target=searchwin id="engine">
<input type=hidden value=????? name=storeid>
<input type=text value='' name=searchterm>
<input type=submit value='Go'> </form>
</div>
</div>
<div class="searchcont">Search For
Products:</div>
</div><!-- End Search Bar -->
Pleasssssseeeeeeee Help
ThanksHi,
Your form is defined in a div named "serchcartcont", you can
use attributes like position and align of the div to do what you
want to do. But there are two more dives above this dive, you will
have define the height width of these before you can center align
the inner most div. If you are not defining the height & width
then by default it decide it automatically to just fit the content
in it.
Hope this helps.
Maneet
LeXolution IT Services
Web Development
Company -
I have iOS 7. When I go to the itunes store on my ipod touch it gives me a blank screen with nothing on it. I restarted my ipod touch and it didn't work. Can someone help me with this?
- Reset the iOS device. Nothing will be lost
Reset iOS device: Hold down the On/Off button and the Home button at the same time for at
least ten seconds, until the Apple logo appears.
- Go to Settings>iTunes and App stores and sign out and sign back in
- Reset all settings
Go to Settings > General > Reset and tap Reset All Settings.
All your preferences and settings are reset. Information (such as contacts and calendars) and media (such as songs and videos) aren’t affected.
- Restore from backup. See:
iOS: How to back up
- Restore to factory settings/new iOS device. -
The calender on my iPhone 4 with iOS 6 no longer syncs with iCal 4.0.4 on my mac OS 10.6.8. However it is syncing with my iCloud account. Can someone help me with this?
FYI: It seems it was a network problem with my WinXP PC. After complete deletion and new installation of XP and iTunes my iPhone will be recognized correctly, Wifi synchronization works (mostly) fine.
-
Hi, can someone help me with my External HDD??? Please
Hi, Can someone help me with my Extenal HDD???
PleaseAfter you have all of the files from the External HDD you want to save, to format the HDD:
Open Launchpad
Open Utilities
Open Disk Utility
Select Hard Drive to format (the external HDD)
If you want to change partition size or number select Partition Table
Select number of partitions and adjust sizes if more than one
Name the partitions
Select the format from the pop-up menu (use Mac OS Extended (Journaled))
If it is not already selected, select GUID Partition Table
Click OK
Click Apply
And it should do the formatting for you.
Note: giving a name may come after the format selection, I sometimes get that out of order but it will lead you through the process. -
I have a problem with my blackberry 9360, I bought it last 2months, and now when I use video camera or camera I saw a red and blue line. Can someone help me with this issue?
Hello zukafu,
Welcome to the forums.
In this case we can try to reload the software on the BlackBerry® smartphone to make sure it is running the latest version and there are no issues with the OS.
Here is how to backup your BlackBerry smartphone http://bbry.lv/oPVWXc
Once you have backed up your BlackBerry smartphone please follow the link below to complete a clean reload of the BlackBerry smartphone software.
Link: http://www.blackberry.com/btsc/KB03621
Once completed test it and proceed with a selective restore, here is how to restore http://bbry.lv/qgQxLo
Thank you
-SR
Come follow your BlackBerry Technical Team on twitter! @BlackBerryHelp
Be sure to click Kudos! for those who have helped you.Click Solution? for posts that have solved your issue(s)! -
i need help replacing a battery in my ipod nano 4th geneartion 16 gb can someone help me with step by step instructions or help me send it to apple store and replace and if so how?
Here is how to do it yourself.
http://www.youtube.com/watch?v=2h53otOBTsI
Here is how to send it to apple.
http://www.apple.com/support/ipod/service/battery/
Hope this helps! -
HI everybody i want to ask if you come me in help, i want to draw paths but when i use stroke options with pen or brush settings i loose quality when i zoom in , can someone help me with pen settings???
The work path is a vector object, and infinitely scalable, but when you stroke it, Photoshop lays pixels on a layer that follow the path. These pixels are raster based and can not be scaled without loosing quality. You do have options. If you want to make the raster layer bigger, transform the work path and stroke it again. Or work at a higher resolution in the first place.
Incidentally, you can't stroke a Path with the Pen, because it is a Vector based tool, and stroking is a raster based function. -
Hi! Can someone help me with repair service address for Palm TX?
Hi! Can someone help me with repair service address for Palm TX?
This question was solved.
View Solution.Good luck, and please let us know here how it works out for you. We love knowing of current resources who can help solve people's problems with these older devices.
smkranz
I am a volunteer, and not an HP employee.
Palm OS ∙ webOS ∙ Android -
I have followed the instructions to update Flash Player, the Installation Fails at about 90%, it says that there is an Application running (Safari) and it says to close all the apps. and start again ... but I already close all the Applications ... none is running ... can someone help me with this issue ??? Thanks ...
Dear Dominic
Brilliant reply. Simple English. Simple to follow instructions. And it worked immediately, first time.
Why couldn't the Apple and Adobe corporations get their programming right first time? We spend billions of UK pounds and US dollars with them. They reply with incompetent programming such as this, and arrogance to their customers in issuing faulty systems without doing the most rudimentary checks.
Anyway, I certainly shan't be buying another Apple as this is the most unreliable, most incomprehensible, most illogical and downright thoughtless shoddy piece of computer kit which I have ever owned. And all of it is rubbish ~ emails disappear, photos can't be organised properly, spreadsheets don't work, Pages is laborious… the list goes on and on...
But thanks to you Dominic, I have been able to load Adoble Flashj… maybe eyou should get a job at Apple, and set them all on the right course to how to work simply and correctly with customers.
Thanks again,
David -
After the OS 6 update my speaker does not work. Volume control on the side does not adjust the volume either. My music plays but no sound comes out. Can someone help me with this issue? I've tried rebooting my phone but still no sound comes out. I currently have the 4S.
try to activate and desactivate the airplne switch a couple of time
Maybe you are looking for
-
Hi, I recently create a webservice application. It work fine when the server is implemented as java application. But when rewritten as web application( *.war), the deploiement work on WLS. However it throws java.io.InvalidClassException: org.eclipse
-
Storage location reference per Storage location
Hello Experts, We have a storage location X000 and it has assign storage loc ref 00( GR to VZ1 ) therefore during the GR the storage loc S000 go through VZ1, before Schedule agreement is created with x000. I require that in the same process the syste
-
Start Asynchrono​us Call available on Real-Time or not?
If I work on code on an RT target the new Start Asyncronous Call nodes do not show up on the Application Control Palette. However, LabVIEW does not complain if I trick it to run such a node on RT by adding it while editing it for a Windows target...S
-
Hello, If I am calling Report from Runtime Form, and I passing prameters to the report, and I dont want to show to the end user the Report's Parameter Form what should I do ?! Thanks Alot.
-
Replace screen on HP Pavilion dv4-2165dx Entertainment Notebook PC
How do I replace the screen on HP Pavilion dv4-2165dx Entertainment Notebook PC This question was solved. View Solution.