Welcome, Guest: Register On Nairaland / LOGIN! / Trending / Recent / New
Stats: 3,155,210 members, 7,825,790 topics. Date: Sunday, 12 May 2024 at 11:28 PM

How Can I Change A Label Display - Programming - Nairaland

Nairaland Forum / Science/Technology / Programming / How Can I Change A Label Display (1338 Views)

How Do I Change The Color Of A Grid In Bootstrap / Help,how Do I Send Data From An Msaccess Table To A Label In My Vb6 Appl / Vb.net Code To Display Image In Picturebox From Sql Server (2) (3) (4)

(1) (Reply) (Go Down)

How Can I Change A Label Display by Danyl(m): 10:24am On Aug 24, 2012
@all the great programmers in the house, i want to develop an application that changes the display of a label, something like a question and answer thing, i will click a next button, and it will change the texts in the label, i tried to use a string array to hold the texts which i split according usin the scanner class,and store the splitted string in other arrays ,used a button that implements the actionlistener interface, i tried to use a for loop to increase my count but the label is not moving as i thought, i tried that using the card layout but it has to be changing too many panels which may be too robust for the program,pls programmers in the house help. thanks
Re: How Can I Change A Label Display by Javanian: 10:48am On Aug 24, 2012
Paste your code
Re: How Can I Change A Label Display by Nobody: 5:58pm On Aug 24, 2012
java or actionscript? why not post your code
Re: How Can I Change A Label Display by naijaswag1: 9:47pm On Aug 24, 2012
Danyl: @all the great programmers in the house, i want to develop an application that changes the display of a label, something like a question and answer thing, i will click a next button, and it will change the texts in the label, i tried to use a string array to hold the texts which i split according usin the scanner class,and store the splitted string in other arrays ,used a button that implements the actionlistener interface, i tried to use a for loop to increase my count but the label is not moving as i thought, i tried that using the card layout but it has to be changing too many panels which may be too robust for the program,pls programmers in the house help. thanks
I can decipher Java.Be elaborate and explicit.In SWT,I will use Stack layout,in SWING,card layout is right.I know what you are talking about.Something like objective questions interface.
Re: How Can I Change A Label Display by Danyl(m): 10:12pm On Aug 25, 2012
naija_swag:
I can decipher Java.Be elaborate and explicit.In SWT,I will use Stack layout,in SWING,card layout is right.I know what you are talking about.Something like objective questions interface.
yeah something like an objective question interface, someone said i could use a database at d back end,retrieve d questns into a resultset object n display d text using a counter...
Re: How Can I Change A Label Display by dellnet: 11:04pm On Aug 25, 2012
Array and Global counter will do. I think more important is to be able to track the state of your counter.
Re: How Can I Change A Label Display by naijaswag1: 3:49am On Aug 26, 2012
You can read the question from a file or a database.

dell_net: Array and Global counter will do. I think more important is to be able to track the state of your counter.

Add a next and back button whose actionlistener or selectionlister will use the array index to navigate the question and display on the interface while sliding through your stacklayout or cardlayout.I did something like that,an instruction material for primary school for someone.
Re: How Can I Change A Label Display by Danyl(m): 12:37pm On Aug 26, 2012
naija_swag: You can read the question from a file or a database.



Add a next and back button whose actionlistener or selectionlister will use the array index to navigate the question and display on the interface while sliding through your stacklayout or cardlayout.I did something like that,an instruction material for primary school for someone.

I was able to use card layout but i want a flexible method,the card layout cannot be updated easily like a data file or database.
I used the java derby database n i think retrieving d questions and answers into a result set,splitting it into string arrays n traversing d array is more or less the same as using a datafile... Here is my code dt uses the split method of d scanner class:
import java.util.*;
import javax.swing.*;
import java.awt.*;
import java.awt.event;
import java.io.*;

public class Quest extends JFrame implements ActionListener,Serializable{

int counter=0;
File file=new File("questdata.txt"wink
Scanner sc=null;
String []question=null;
public Quest(){
super("Question and Answers"wink;
setSize(300,300);
setVisible(true);
setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);

JLabel questLabel=new JLabel(question[i]);
}
public void actionPerformed(ActionEvent evt){
}
public static void main(String[] args)
{
Quest que=new Quest();
}
}
I'll add the remaining part,I wrote this on my phone..
Thanks to all n everyone 4ur responses... i'll try this n add my remaining codes...
Re: How Can I Change A Label Display by sealteam66(m): 6:08pm On Jan 08, 2014
Post your problem here

https://www.nairaland.com/1584882/most-java-problems-solved

and have your programming issue resolved

(amongst other things I want to aggregate most of my efforts)
Re: How Can I Change A Label Display by Danyl(m): 6:11pm On Jan 08, 2014
sealteam66: Post your problem here

https://www.nairaland.com/1584882/most-java-problems-solved

and have your programming issue resolved

(amongst other things I want to aggregate most of my efforts)
the problem is already solved. thanks.
Re: How Can I Change A Label Display by sealteam66(m): 11:10pm On Jan 08, 2014
Would you like to have sound incorporated into the program?

Post on my thread if so
Re: How Can I Change A Label Display by Danyl(m): 9:55am On Jan 09, 2014
sealteam66: Would you like to have sound incorporated into the program?

Post on my thread if so
that is interesting? do u have any API for that or you created it? I will be interested in such as it wil enable blind ppl d benefit of taking d test.
Re: How Can I Change A Label Display by naijaswag1: 1:19pm On Jan 09, 2014
Java has an API in Java 7 for sound. Check it out.
Re: How Can I Change A Label Display by Danyl(m): 5:44pm On Jan 09, 2014
naija_swag: Java has an API in Java 7 for sound. Check it out.
I need to port to jdk7.0 b that om thanks.
Re: How Can I Change A Label Display by sealteam66(m): 6:58am On Jan 10, 2014
If you are interested in having sound incorporated in your programme, post on my thread

https://www.nairaland.com/1584882/most-java-problems-solved

You create the sound file and your java programme will read it, also you don't need API just the sun audio import for netbean, I can give you a

sound recorder - so you can use your laptop to create the sound files, or for premium quality go to a sound studio

(1) (Reply)

... / With Books, Learn C++, C#, CSS, HTML, Java, SQL & XML In 21 Days / Help Construct An Algorithm In Php Code

(Go Up)

Sections: politics (1) business autos (1) jobs (1) career education (1) romance computers phones travel sports fashion health
religion celebs tv-movies music-radio literature webmasters programming techmarket

Links: (1) (2) (3) (4) (5) (6) (7) (8) (9) (10)

Nairaland - Copyright © 2005 - 2024 Oluwaseun Osewa. All rights reserved. See How To Advertise. 21
Disclaimer: Every Nairaland member is solely responsible for anything that he/she posts or uploads on Nairaland.