Suggested case list:
Using timer to refresh a grid
383guest172.69.33.12125nk0uiMay 7, 2020 7:23:47 AMlinkuser model to move item to another listbox
120guest162.158.193.148d0n3krApr 2, 2020 5:28:28 AMlinkDisabled list item row passed to VM-1981
296fatih123160.83.36.13025nk0uiFeb 13, 2018 4:25:44 PMlinkDisabled list item row passed to VM-1981
295fatih123160.83.36.13025nk0uiFeb 13, 2018 4:25:16 PMlinkDisabled list item row passed to VM-1981
294fatih123160.83.36.13225nk0uiFeb 13, 2018 3:30:44 PMlinkgrid sample with ListModel/RowRenderer
816guest80.82.2.1312vah9ajFeb 21, 2017 11:42:21 AMlinkgrid sample with ListModel/RowRenderer
809guest175.98.113.1622vah9ajJan 26, 2017 9:19:33 AMlinkgrid sample with ListModel/RowRenderer
196guest79.185.142.402vah9ajApr 26, 2014 10:53:57 PMlinkgrid sample with ListModel/RowRenderer
195guest79.185.142.402vah9ajApr 26, 2014 10:53:54 PMlinkgrid sample with ListModel/RowRenderer
194guest79.185.142.402vah9ajApr 26, 2014 10:53:51 PMlinkgrid sample with ListModel/RowRenderer
193guest79.185.142.402vah9ajApr 26, 2014 10:53:48 PMlinkgrid sample with ListModel/RowRenderer
192guest79.185.142.402vah9ajApr 26, 2014 10:53:44 PMlinkgrid sample with ListModel/RowRenderer
191guest79.185.142.402vah9ajApr 26, 2014 10:53:40 PMlinkHierarchy table without using ZK PE/EE
1aaknai151.28.135.2131s871daJul 29, 2013 11:02:46 PMlinkgrid sample with ListModel/RowRenderer
128aaknai151.28.135.2132vah9ajJul 29, 2013 7:20:00 PMlinkuser model to move item to another listbox
1TonyQ114.25.109.94d0n3krApr 21, 2012 10:43:27 AMlinkUsing timer to refresh a grid
1TonyQ220.133.44.3725nk0uiFeb 17, 2012 3:17:34 AMlinkFire a event from child iframe
1TonyQ220.133.44.372eupjotFeb 3, 2012 5:04:52 AMlinkTextbox input restriction sample
1TonyQ72.21.245.2431b3nlr0Dec 20, 2011 10:09:10 AMlinkTest web core taglib in ZUL
1TonyQ198.203.175.175ofqkemDec 17, 2011 3:36:08 AMlinkLatest 10 Fiddles :
constraint binding textbox
3guest172.68.151.16220peldaDec 5, 2025 5:08:19 PMlinkAnother new ZK fiddle
2guest172.68.151.16320peldaDec 5, 2025 5:07:51 PMlinkAnother new ZK fiddle
1guest172.68.151.16220peldaDec 5, 2025 5:07:32 PMlinkAnother new ZK fiddle
1peggypeng172.71.154.99364f4neDec 5, 2025 9:24:31 AMlinktooltip example
2guest104.22.23.13rc1ntoDec 4, 2025 2:23:45 PMlinkAnother new ZK fiddle
1guest172.69.134.2277t7602Dec 4, 2025 1:40:46 PMlinkAnother new ZK fiddle
1peggypeng104.22.17.1802df6e3oDec 4, 2025 8:41:29 AMlinkonClose
1peggypeng172.68.87.248j8kd8aDec 3, 2025 4:10:26 AMlinkAnother new ZK fiddle
1peggypeng172.69.134.2271rm7f4eNov 26, 2025 3:31:24 AMlinkZK-5912-Suggestion
2rebeccalai104.22.20.1442qrmiiuNov 26, 2025 2:07:15 AMlinkupdate the textbox value and fire a onChange event (Client)
45guest75.131.224.48qdorurJan 27, 2013 10:08:41 AMlinkresources
index.zulzul<zk xmlns:w="client">
<textbox id="txt" value="test" onChange='alert("client updated:"+ event.getValue());' />
<button id="test" label="click me to change value and updateChange_" w:onClick="var t = zk.Widget.$('$txt');t.$n().value=('test2');t.updateChange_();" />
</zk>
Game.javajavaimport java.awt.GridLayout;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.event.ItemEvent;
import java.awt.event.ItemListener;
import java.util.ArrayList;
import java.util.List;
import javax.swing.*;
import javax.swing.border.*;
public class Game extends JFrame {
private static final long serialVersionUID = 1L;
JButton sixEight, fiveNine, fourTen, createQuestion, submitAnswer;
JRadioButton easy, medium, hard;
JTextField answer;
JTextArea questionTextBox, answerTextBox;
JCheckBox hiLo, elevenTwelve, horn, hornHigh2, hornHigh12, hornHigh3,
hornHigh11, threeWayCrap, anyCrap, cAndE, anySeven, sevenEleven,
world, hiLoYo, acesOrTwelve, yoOrAceDeuce;
JLabel answerLabel;
double answerToQuestion = 0.0;
int difficulty = 1; //default is easy = 1 , medium = 2, hard = 3
int enteredAnswer; // all answers must be integers because that is what you
// will pay
ArrayList<Bet> listOfBets = new ArrayList<Bet>(); //used to store multiple prop bets
int sixEightEasy[] = {6, 12, 18, 24, 30, 42, 60, 90, 120};
int sixEightMed[] = {6, 10, 11, 12, 15, 16, 18, 20, 21, 24, 25, 26, 30, 36, 42,
48, 50, 54, 60, 66, 72, 84, 90, 96, 100, 102, 108, 114, 120,
150, 180, 200, 210, 240, 270, 300, 420, 500, 600, 720, 900, 1000, 1200};
int sixEightHard;
int fiveNineEasy[] = {5, 10, 15, 20, 25, 50, 75, 100};
int fiveNineMed[] = {5, 10, 15, 20, 25, 30, 35, 36, 40, 45, 50, 55, 60, 65,
70, 72, 75, 80, 85, 90, 95, 100, 150, 200, 250, 300, 400, 500, 1000};
int fiveNineHard = (int) (Math.random() * 1000);
int fourTenEasy[] = {5, 10, 15, 20, 25, 50, 100};
int fourTenMed[] = {5, 10, 15, 20, 25, 30, 35, 40, 45, 50, 55, 60, 65, 70,
75, 80, 85, 90, 95, 100, 150, 200, 250, 300, 400, 500, 1000};
int fourTenHard = (int) (Math.random() * 1000);
public static void main(String[] args) {
new Game();
}
public Game() {
this.setSize(600, 800);
this.setLocationRelativeTo(null);
this.setDefaultCloseOperation(EXIT_ON_CLOSE);
this.setTitle("Welcome to the Craps Test");
JPanel mainPanel = new JPanel();
ListenForButton buttonListener = new ListenForButton();// Listener for Buttons
ListenForCheckBoxStateChange checkListener = new ListenForCheckBoxStateChange();
// creating radio buttons
easy = new JRadioButton("easy");
medium = new JRadioButton("medium");
hard = new JRadioButton("hard");
// creates a new button group
ButtonGroup difficultyButtons = new ButtonGroup();
difficultyButtons.add(easy);
difficultyButtons.add(medium);
difficultyButtons.add(hard);
// sets up the border for the radio panel
JPanel difficultyPanel = new JPanel();
Border diffBorder = BorderFactory.createTitledBorder("difficulty");
difficultyPanel.setBorder(diffBorder);
// adds the buttons to the panel
difficultyPanel.add(easy);
difficultyPanel.add(medium);
difficultyPanel.add(hard);
easy.setSelected(true); // sets default to easy
mainPanel.add(difficultyPanel); // adds the panel to the main panel
sixEight = new JButton("place bet 6 or 8");
fiveNine = new JButton("place bet 5 or 9");
fourTen = new JButton("place bet 4 or 10");
ButtonGroup placeBetButtons = new ButtonGroup();
placeBetButtons.add(sixEight);
placeBetButtons.add(fiveNine);
placeBetButtons.add(fourTen);
JPanel placeBetsPanel = new JPanel();
Border placeBetsBorder = BorderFactory
.createTitledBorder("Place Bet Question Generator");
placeBetsPanel.setBorder(placeBetsBorder);
placeBetsPanel.add(sixEight);
placeBetsPanel.add(fiveNine);
placeBetsPanel.add(fourTen);
sixEight.addActionListener(buttonListener); //adds listener to 6/8 button
fiveNine.addActionListener(buttonListener); //adds listener to 5/9 button
fourTen.addActionListener(buttonListener); //adds listener to 4/10 button
mainPanel.add(placeBetsPanel); // adds the panel to the main panel
// creating check boxes
hiLo = new JCheckBox("Hi/Lo");
elevenTwelve = new JCheckBox("11/12");
horn = new JCheckBox("Horn");
hornHigh2 = new JCheckBox("Horn High Aces");
hornHigh3 = new JCheckBox("Horn High Ace Deuce");
hornHigh11 = new JCheckBox("Horn High Yo");
hornHigh12 = new JCheckBox("Horn High Twelve");
threeWayCrap = new JCheckBox("3 Way Crap");
anyCrap = new JCheckBox("Any Crap");
cAndE = new JCheckBox("C & E");
anySeven = new JCheckBox("Any Seven (Red)");
sevenEleven = new JCheckBox("7/11");
world = new JCheckBox("World");
hiLoYo = new JCheckBox("High Lo Yo");
acesOrTwelve = new JCheckBox("Aces or Twelve");
yoOrAceDeuce = new JCheckBox("Yo or Ace-Deuce");
List<JCheckBox> checkBoxes = new ArrayList<JCheckBox>();
checkBoxes.add(acesOrTwelve);
// sets up the border for the check box panel
JPanel propBetsPanel = new JPanel();
GridLayout twoColumnLayout = new GridLayout(0, 2);
propBetsPanel.setLayout(twoColumnLayout);
Border propBetsBorder = BorderFactory
.createTitledBorder("Proposition Bets");
propBetsPanel.setBorder(propBetsBorder);
// adds the check boxes to the panel
propBetsPanel.add(hiLo);
propBetsPanel.add(elevenTwelve);
propBetsPanel.add(horn);
propBetsPanel.add(hornHigh2);
propBetsPanel.add(hornHigh3);
propBetsPanel.add(hornHigh11);
propBetsPanel.add(hornHigh12);
propBetsPanel.add(threeWayCrap);
propBetsPanel.add(anyCrap);
propBetsPanel.add(cAndE);
propBetsPanel.add(anySeven);
propBetsPanel.add(sevenEleven);
propBetsPanel.add(world);
propBetsPanel.add(hiLoYo);
propBetsPanel.add(acesOrTwelve);
propBetsPanel.add(yoOrAceDeuce);
hiLo.addItemListener(checkListener);
elevenTwelve.addItemListener(checkListener);
horn.addItemListener(checkListener);
hornHigh2.addItemListener(checkListener);
hornHigh3.addItemListener(checkListener);
hornHigh11.addItemListener(checkListener);
hornHigh12.addItemListener(checkListener);
threeWayCrap.addItemListener(checkListener);
anyCrap.addItemListener(checkListener);
cAndE.addItemListener(checkListener);
anySeven.addItemListener(checkListener);
sevenEleven.addItemListener(checkListener);
world.addItemListener(checkListener);
hiLoYo.addItemListener(checkListener);
acesOrTwelve.addItemListener(checkListener);
yoOrAceDeuce.addItemListener(checkListener);
mainPanel.add(propBetsPanel); // adds the panel to the main panel
// creates prop bet button
createQuestion = new JButton("Create Prop Bet Question");
mainPanel.add(createQuestion);// adds the button to the main panel
createQuestion.addActionListener(buttonListener); //adds listener to createQuestion button
// creates first text area for questions.
questionTextBox = new JTextArea(5, 30);
questionTextBox.setLineWrap(true);
questionTextBox.setWrapStyleWord(true);
JScrollPane scrollbars = new JScrollPane(questionTextBox,
JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED,
JScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED);
JPanel questionPanel = new JPanel();
Border questionPanelBorder = BorderFactory
.createTitledBorder("Question");
questionPanel.setBorder(questionPanelBorder);
questionPanel.add(questionTextBox);
mainPanel.add(questionPanel);// adds the mainPanel
// answerPanel
answerLabel = new JLabel("Answer here and hit submit");
answer = new JTextField(7);
submitAnswer = new JButton("Submit");
submitAnswer.addActionListener(buttonListener);
JPanel answerPanel = new JPanel();
Border answerPanelBorder = BorderFactory.createTitledBorder("Answer");
answerPanel.setBorder(answerPanelBorder);
answerPanel.add(answerLabel);
answerPanel.add(answer);
answerPanel.add(submitAnswer);
mainPanel.add(answerPanel); // adds the answer panel to main panel.
// creates second text area for answers to the questions.
answerTextBox = new JTextArea(5, 30);
JPanel answerTextPanel = new JPanel();
Border answerTextPanelBorder = BorderFactory
.createTitledBorder("Answer");
answerTextPanel.setBorder(answerTextPanelBorder);
answerTextPanel.add(answerTextBox);
mainPanel.add(answerTextPanel);// adds the mainPanel
// //end of GUI adds
this.add(mainPanel); // adds main panel to the frame
this.setVisible(true);
}
private class ListenForButton implements ActionListener {
@Override
public void actionPerformed(ActionEvent e) {
if (e.getSource() == submitAnswer) {
try {
enteredAnswer = Integer.parseInt(answer.getText());
System.out.println(enteredAnswer);
if (enteredAnswer == answerToQuestion) {
answerTextBox.setText("You are correct, the answer was: " + answerToQuestion);
} else {
answerTextBox.setText("This was an incorrect answer\n"
+ "The answer was " + answerToQuestion);
}
} catch (NumberFormatException ex) {
JOptionPane.showMessageDialog(Game.this,
"Please enter an integer for your answer.",
"Number Format Error", JOptionPane.ERROR_MESSAGE);
// System.exit(0);
}
}
if (e.getSource() == sixEight) {
int rand = 0;
int d = checkDifficulty();
if (d == 1){
rand = getRandomArrayNumber(sixEightEasy);
}else if (d == 2){
rand = getRandomArrayNumber(sixEightMed);
}else if (d == 3){
rand = (int) (Math.random() * 1000);
}
Bet b = new Bet("6 or 8", rand, 6);
questionTextBox.setText(b.getQuestion());
answerToQuestion = b.getAnswer();
}
if (e.getSource() == fiveNine) {
int d = checkDifficulty();
}
if (e.getSource() == fourTen) {
int d = checkDifficulty();
}
} //end of ActionPerformed
} //end of ListenForButton
private class ListenForCheckBoxStateChange implements ItemListener {
@Override
public void itemStateChanged(ItemEvent e) {
//throw new UnsupportedOperationException("Not supported yet.");
}//end of state change method
} //end of Listen for checkbox state change class
public int checkDifficulty() {
int r = 0;
if (easy.isSelected()) {
r = 1;
} else if (medium.isSelected()) {
r = 2;
} else if (hard.isSelected()) {
r = 3;
}
return r;
} //end of checkDifficulty
public int getRandomArrayNumber(int[] arr){
int[] tempArray = arr;
int length = tempArray.length - 1;
int randIndex = (int) (Math.random() * length);
return tempArray[randIndex];
} //end of getRandomArrayNumber
}//End of Class
Bet.javajavapublic class Bet {
private int units, roll;
private String betType;
private String question;
public Bet(String whatTypeOfBet, int HowManyUnits, int Roll){
betType = whatTypeOfBet;
units = HowManyUnits;
roll = Roll;
}
public void createQuestion(){
question = "What does $" + units + " pay on a " + betType + "?\n" + roll + " is the roll..";
System.out.println("Create Question: " + question);
}
public double getAnswer(){
double answer = 0.0;
if (betType.equals("6 or 8")){
answer = (units / 6.0) * 7.0;
System.out.println("The answer: " + answer);
}
return answer;
}
public String getQuestion(){
createQuestion();
System.out.println("Get Question: " + question);
return question;
}
}
Roll.javajavapublic class Roll {
int[] rollArray = {2, 3, 11, 12};
int roll = 0;
public Roll() {
this.roll = (int) ((Math.random() * (rollArray.length)));
}
public void getRoll() {
System.out.println("The Roll was: " + rollArray[roll]);
}
}