How to add checkbox in dropdown box
hi to all
please help me urgent
can we add check box in to the drop down box in screen painter..?
if yes then please tell me in detail.
thank you...
Hi,
In drop down ( combo box) u can select only one item at a time. so why do u need check box ?
Similar Messages
-
ADD ITEMS TO DROPDOWN BOX FROM A TEXT FIELD(USER ENTERS THE ITEM) AND BOUND VALUE ALSO
I WANT TO ADD ITEMS THE DROPDOWN BOX FROM THE TEXT FIELD(ITEM NAME) WHERE USER ENTER'S THE ITEM DESCRIPTION
AND BOUND VALUE ALSO SHOULD BE ADDED TO THE SAME ITEM.
SAME WAY REMOVE ITEMS FROM DROPDOWN BOX
PLEASE GIVE SAMPLE FORM OR JAVASCRIPT FOR THE ABOVE SCENARIO.....
INDEED HELPFUL FOR MY PROJECT PLEASE SEND ATTACHED PDF FORMHi Praveen,
Your form is not shared so I have not been able to access it. But I have updated mine. There are now two approaches, one that follows on from the above method and updates each drop down list in each row. The second updates a separate dataset that the drop down list is bound to. This second approach requires the remerge() method which can cause problems if your code has updates some form properties like a borders color as these will be reset, but the code is simplier and you will only have one list to maintain. The add button click code is;
var particulars = xfa.datasets.resolveNode("particulars");
if (particulars === null)
particulars = xfa.datasets.createNode("dataGroup","particulars");
xfa.datasets.nodes.append(particulars);
var particular = xfa.datasets.createNode("dataValue","particular");
particular.value = ItemName.rawValue;
var boundValue = xfa.datasets.createNode("dataValue","id");
boundValue.value = BoundValue.rawValue;
particular.nodes.append(boundValue);
boundValue.contains = "metaData";
// find sorted position to insert
for (var i = 0; i < particulars.nodes.length; i++)
p = particulars.nodes.item(i);
if (p.value > particular.value)
particulars.nodes.insert(particular, p);
break;
// add to end if greater than all existing items
if (particular.parent === null)
particulars.nodes.append(particular);
// clear source fields
ItemName.rawValue = null;
BoundValue.rawValue = null;
// remerge form data to pick up new item
xfa.form.remerge();
And the binding looks like;
I have updated my sample to include both methods, https://workspaces.acrobat.com/?d=OwysfJa-Q3HhPtFlgRb62g
Regards
Bruce -
How to add Gap between dropdown List Items - ComboBox in MFC VC++
How to add Gap between dropdown List Items - ComboBox in MFC VC++
Did you tried SetItemHeight() inside your App .
Thanks
Rupesh Shukla -
How to add "Search this site" box to subsites
Hello!
We have SP 2013 Enterprise installed.
There is a search box on the main site. How to add the same search box to subsites also (with possibility to search on the subsite)?
Thanks!Hi ,
please add search webpart and configure the same
http://msdn.microsoft.com/en-us/library/dd452356.aspx
http://msdn.microsoft.com/en-us/library/office/ff512796(v=office.14).aspx
http://social.technet.microsoft.com/Forums/sharepoint/en-US/a967edda-fe7f-429a-97fb-da6405072ea5/search-on-a-subsite-webpart?forum=sharepointgeneralprevious
Please remember to click 'Mark as Answer' on the answer if it helps you -
How to Add Checkbox and icon in ALVGRID
Hi Experts,
i have one Requirement. i need to add Checkbox, Selectall,icon(Unlock or inactive) infront of Contracts of ALV GRID.How to achive that.
Thanks,
Venkat.Hi
For check box
At declaring field catalog using structure LVC_S_FCAT
mark CHECKBOX = 'X' and also EDIT = 'X'.
For reference check below subroutine in program BCALV_EDIT_05.
form build_fieldcat changing pt_fieldcat type lvc_t_fcat.
data ls_fcat type lvc_s_fcat.
call function 'LVC_FIELDCATALOG_MERGE'
exporting
i_structure_name = 'SFLIGHT'
changing
ct_fieldcat = pt_fieldcat.
*§A2.Add an entry for the checkbox in the fieldcatalog
clear ls_fcat.
ls_fcat-fieldname = 'CHECKBOX'.
* Essential: declare field as checkbox and
* mark it as editable field:
ls_fcat-checkbox = 'X'.
ls_fcat-edit = 'X'.
* do not forget to provide texts for this extra field
ls_fcat-coltext = text-f01.
ls_fcat-tooltip = text-f02.
ls_fcat-seltext = text-f03.
* optional: set column width
ls_fcat-outputlen = 10.
append ls_fcat to pt_fieldcat.
endform.
For Icon:
CONSTANTS:
icon_id_failure LIKE icon-id VALUE ' ((Content component not found.)) @',
icon_id_okay LIKE icon-id VALUE ' ((Content component not found.)) @'.
TYPES: BEGIN OF ls_tab,
matnr LIKE equi-matnr,
maktx LIKE makt-maktx,
b_werk LIKE equi-werk,
b_lager LIKE equi-lager,
lgobe LIKE t001l-lgobe,
sernr LIKE equi-sernr,
icon LIKE icon-id,
objnr LIKE equi-objnr,
END OF ls_tab.
*Table that display the data for the ALV.
DATA: itab TYPE ls_tab OCCURS 0 WITH HEADER LINE.
PERFORM get_h_date .
IF h_date => sy-datum .
itab-icon = icon_id_okay.
ELSE .
itab-icon = icon_id_failure.
ENDIF.
Regards
Sudheer -
Hi Experts, oo hierarchical alv, how to add checkbox on every header?
Hi Experts,
I am working on oo hierarchical alv, how can I add checkbox on every header? thanks in advance!
Kind regards
DawsonHi Dawson,
Just refer the below program & pass the check box functionality (mentioned in bold) in REUSE_ALV_HIERSEQ_LIST_DISPLAY in your program.
TYPE-POOLS : slis.
Data
DATA : BEGIN OF itab OCCURS 0.
INCLUDE STRUCTURE t001.
DATA : flag tyPE c,
END OF itab.
DATA : alvfc TYPE slis_t_fieldcat_alv.
DATA : alvly TYPE slis_layout_alv.
Select Data
SELECT * FROM t001 INTO TABLE itab.
*------- Field Catalogue
CALL FUNCTION 'REUSE_ALV_FIELDCATALOG_MERGE'
EXPORTING
i_program_name = sy-repid
i_internal_tabname = 'ITAB'
i_inclname = sy-repid
CHANGING
ct_fieldcat = alvfc
EXCEPTIONS
inconsistent_interface = 1
program_error = 2
OTHERS = 3.
Display
alvly-box_fieldname = 'FLAG'.
CALL FUNCTION 'REUSE_ALV_LIST_DISPLAY'
EXPORTING
it_fieldcat = alvfc
i_callback_program = sy-repid "<-------Important
i_callback_user_command = 'ITAB_USER_COMMAND' "<------ Important
is_layout = alvly
TABLES
t_outtab = itab
EXCEPTIONS
program_error = 1
OTHERS = 2.
CALL BACK FORM
FORM itab_user_command USING whatcomm TYPE sy-ucomm whatrow TYPE
slis_selfield.
LOOP AT itab.
itab-flag = 'X'.
MODIFY itab.
ENDLOOP.
IMPORTANT.
WHATROW-REFRESH = 'X'.
ENDFORM. "ITAB_user_command
Regards
Abhii... -
How to add checkboxes to frame
So I have two classes in my package. I am having trouble adding the checkbox group to my frame. I got it to add to my applet but I can not figure out how to add it to my frame. Here is what I have so far. When I run this program it puts the checkboxes in my applet and not in my frame.
this is my painter class:
package pt;
* <p>Title: </p>
* <p>Description: </p>
* <p>Copyright: Copyright (c) 2006</p>
* <p>Company: </p>
* @author unascribed
* @version 1.0
import java.applet.Applet;
import java.awt.*;
import java.awt.event.*;
public class painter extends Applet {
private int xValue=-10, yValue=-10;
MyFrame x;
Checkbox Red, Black, Magenta, Blue, Green, Yellow;
CheckboxGroup cbg;
public void init()
x= new MyFrame("Christie's Window");
x.show();
x.resize(250,100);
cbg = new CheckboxGroup();
Red = new Checkbox("Red", cbg,true);
Black = new Checkbox("Black", cbg,false);
Magenta = new Checkbox("Magenta",cbg,false);
Blue = new Checkbox("Blue", cbg, false);
Green = new Checkbox("Green", cbg, false);
Yellow = new Checkbox("Yellow", cbg, false);
add(Red);
add(Black);
add(Magenta);
add(Blue);
add(Green);
add(Yellow);
addMouseMotionListener(new MotionHandler(this));
public void paint(Graphics g)
g.drawString("Drag the mouse to draw", 10, 20);
g.fillOval(xValue, yValue, 4,4);
//Override Component class update method to allow all ovals
// to remain on the screen by not clearing the background
public void update(Graphics g) { paint(g); }
// set the drawing coordinates and repaint
public void setCoordinates(int x, int y)
xValue = x;
yValue = y;
repaint();
// Class to handle only mouse drag events for the Drag applet
class MotionHandler extends MouseMotionAdapter {
private painter dragger;
public MotionHandler(painter d) { dragger = d; }
public void mouseDragged( MouseEvent e)
{ dragger.setCoordinates( e.getX(), e.getY() ); }
} and here is MyFrame class:
package pt;
* <p>Title: </p>
* <p>Description: </p>
* <p>Copyright: Copyright (c) 2006</p>
* <p>Company: </p>
* @author unascribed
* @version 1.0
import java.applet.Applet;
import java.awt.*;
import java.awt.event.*;
public class MyFrame extends Frame {
MyFrame(String x){
super(x);
public boolean handleEvent(Event evtObj) {
if(evtObj.id==Event.WINDOW_DESTROY) {
hide();
return true;
return super.handleEvent(evtObj);
}here's your conversion, with listeners to change the color
//import java.applet.Applet;
import java.awt.*;
import java.awt.event.*;
//public class painter extends Applet {
class painter extends Frame {
Color color = Color.RED;
private int xValue=-10, yValue=-10;
//MyFrame x;
Checkbox Red, Black, Magenta, Blue, Green, Yellow;
CheckboxGroup cbg;
//public void init()
public painter()
//x= new MyFrame("Christie's Window");
setTitle("Christie's Window");
//x.show();
//x.resize(250,100);
setSize(600,400);
setLocation(200,100);
cbg = new CheckboxGroup();
Red = new Checkbox("Red", cbg,true);
Red.addItemListener(new ItemListener(){
public void itemStateChanged(ItemEvent ie){
if(Red.getState()) color = Color.RED;}});
Black = new Checkbox("Black", cbg,false);
Black.addItemListener(new ItemListener(){
public void itemStateChanged(ItemEvent ie){
if(Black.getState()) color = Color.BLACK;}});
Magenta = new Checkbox("Magenta",cbg,false);
Magenta.addItemListener(new ItemListener(){
public void itemStateChanged(ItemEvent ie){
if(Magenta.getState()) color = Color.MAGENTA;}});
Blue = new Checkbox("Blue", cbg, false);
Blue.addItemListener(new ItemListener(){
public void itemStateChanged(ItemEvent ie){
if(Blue.getState()) color = Color.BLUE;}});
Green = new Checkbox("Green", cbg, false);
Green.addItemListener(new ItemListener(){
public void itemStateChanged(ItemEvent ie){
if(Green.getState()) color = Color.GREEN;}});
Yellow = new Checkbox("Yellow", cbg, false);
Yellow.addItemListener(new ItemListener(){
public void itemStateChanged(ItemEvent ie){
if(Yellow.getState()) color = Color.YELLOW;}});
Panel p = new Panel();
p.add(Red);
p.add(Black);
p.add(Magenta);
p.add(Blue);
p.add(Green);
p.add(Yellow);
add(p,BorderLayout.NORTH);
addMouseMotionListener(new MotionHandler(this));
addWindowListener(new WindowAdapter(){
public void windowClosing(WindowEvent we) { System.exit(0); }});
public void paint(Graphics g)
super.paint(g);
g.setColor(color);
g.drawString("Drag the mouse to draw", 10, 75);
g.fillOval(xValue, yValue, 4,4);
//Override Component class update method to allow all ovals
// to remain on the screen by not clearing the background
public void update(Graphics g) { paint(g); }
// set the drawing coordinates and repaint
public void setCoordinates(int x, int y)
xValue = x;
yValue = y;
repaint();
// Class to handle only mouse drag events for the Drag applet
class MotionHandler extends MouseMotionAdapter {
private painter dragger;
public MotionHandler(painter d) { dragger = d; }
public void mouseDragged( MouseEvent e)
{ dragger.setCoordinates( e.getX(), e.getY() ); }
public static void main(String[] args){new painter().setVisible(true);}
} -
How can I make a dropdown box populate with values from other fields?
I am trying to create a NCAA bracket where they select teams from a dropdown menu. For example, they choose which teams win in game 1 and 2 through a dropdown box. The winner of games 1 and 2 then play each other, so how can I populate the dropbox with their selections for game 1 and 2?
Game 1 winner --
(game 9) |--- Game 9 winner
Game 2 winner --
Game 9 winner needs to populate with their selections from game 1 winner and game 2 winner.I would look at using the setItems Acrobat JavaScript method.
Have you considered using a Mouse Up action for "Game 1" and "Game 2" to fill "Game 9" -
Hi,
I want to add CheckBox in Table. my requirement is multiselection. I Implemented the following steps, but it's not working. anyone can tell me,what mistake i did?
I created two "Value Attribute"(check,Name) under a "Value Node"(Student) in context.
check - Boolean
Name - mapped a Dictionary simple Type(5 values)
Include a Table in Layout and select Create Binding on right clicking of Table.
Checked only Student and check -> Next
Selected the Editor as checkbox -> Finish
Selected Name from context and assigned to checkbox text property.
Then I deployed the application. But only one checkbox is displayed in Table without any text.
Please give me the suggestion, how to do this.
Thanks in Advance
RajakumarHello,
I think you have a fundamental misunderstanding on how Checkboxes work. A Checkbox triggers a boolean value with true (checked) or false (uncheked).
When you map your name attribut to text you will see the content of that attribute as text behind. But not the metadata.
You may want to use a RadiobuttonGroup or CheckboxGroup for your purpose.
Frank -
How to add an out-of-box JMS modules?
Hi,
I am using WebLogic Server 10.3. For my project, I need to add some out-of-box JMS modules so that there is no need to ask the administrators to create and configure them. I wonder how I can achieve this. Is it good enough just to make changes on the config/config.xml and add a corresponding *-jms.xml?
Thank you,
YangHere's a more sophisticated version of the script Kats supplied. It is a bit more flexible, and works around issues that can arise if too many changes are attempted within the same edit session.
# Sample WLST code for creating a simple WebLogic JMS
# configuration using WLST.
# This script sets up two JMS servers on the same
# WebLogic server, each with a queue and a topic.
import sys
from java.lang import System
# A method for finding an mbean.
# It uses "cd()" rather than getMBean() as "cd()" works in more cases.
def findMBean(path):
savePWD=pwd()
try:
cd(path)
value=cmo
cd(savePWD)
return value
except:
print ' --- Please ignore the previous *No stack trace available.* message.'
cd(savePWD)
return None
# A method for creating a JMS server.
def findOrCreateJMSServer(serverMBean, jmsServerName):
jmsServerMBean = findMBean('JMSServers/'+jmsServerName)
if jmsServerMBean is not None:
print ' --- JMS Server '+jmsServerName+' already exists.'
return jmsServerMBean
startEdit()
jmsServerMBean = create(jmsServerName,'JMSServer')
jmsServerMBean.addTarget(serverMBean)
save()
activate(block="true")
print ' --- JMS Server '+jmsServerName+' created.'
return jmsServerMBean
# A method for creating a JMS module for hosting JMS config,
# also creates a subdeployment named 'TheOne' for the JMS server.
# The module target is set to be the same target that's used
# for the passed in JMS server.
def findOrCreateJMSModule(jmsServerMBean, moduleName):
jmsResource = findMBean('JMSSystemResources/'+moduleName)
if jmsResource is not None:
print ' --- Module '+moduleName+' already exists.'
return jmsResource
startEdit()
jmsResource = create(moduleName,'JMSSystemResource')
jmsResource.addTarget(jmsServerMBean.getTarget())
subD = jmsResource.createSubDeployment('TheOne')
subD.addTarget(jmsServerMBean)
save()
activate(block="true")
print ' --- Module '+moduleName+' created.'
return jmsResource
# A method for creating a JMS destination. Pass 'Queue' or 'Topic'
# for destType. This method assumes subdeployment named 'TheOne'.
def findOrCreateJMSDest(destType, jmsModule, destName, destJNDIName):
# see if dest already exists
moduleName=jmsModule.getName()
longname='JMSSystemResources/'+moduleName+'/JMSResource/'+moduleName
if (destType == 'Queue'):
longname+='/Queues/'+destName
elif (destType == 'Topic'):
longname+='/Topics/'+destName
else:
raise Exception('Unknown dest type '+destType)
jmsDest = findMBean(longname)
if jmsDest is not None:
print ' --- Destination '+destName+' already exists.'
return jmsDest
# dest does not exist, create it
startEdit()
if (destType == 'Queue'):
jmsDest = jmsModule.getJMSResource().createQueue(destName)
else:
jmsDest = jmsModule.getJMSResource().createTopic(destName)
jmsDest.setJNDIName(destJNDIName)
jmsDest.setSubDeploymentName('TheOne')
save()
activate(block="true")
print ' --- Destination '+destName+' created.'
return jmsDest
# Connect to a WebLogic Admin Server. When username, password
# and URL are not passed as arguments, connect will prompt
# for these values.
#connect('system','mypassword','t3://mymachine:7001')
connect()
edit() # Navigate to the root of the config MBean tree.
print ' --- Enter the name of the WLS server that will host the JMS servers.'
print ' --- Choices: ---'
ls('Servers')
print ' ----------------'
print ' --- --> ',
wlServerName=sys.stdin.readline().strip()
svMBean=findMBean("Servers/"+wlServerName)
if svMBean is None:
print ' --- WebLogic server '+wlServerName+' not found.'
stopExecution(' --- Cannot find the WebLogic myserver '+wlServerName)
try:
jmsServerMBean = findOrCreateJMSServer(svMBean, 'MyJMSServer')
jmsModule = findOrCreateJMSModule(jmsServerMBean, 'MyJMSModule')
findOrCreateJMSDest('Queue', jmsModule, 'MyQueue', 'MyQueue')
findOrCreateJMSDest('Topic', jmsModule, 'MyTopic', 'MyTopic')
print ' --- Configuration complete.'
except:
dumpStack()
print ' --- Error, admin server log may contain details!!!'
stopEdit('y') -
How to add a nice graphic box to code??
How do you add a nice graphic box to code? i wanted to add a little back ground colour and title with a white box for imput like
http://img211.imageshack.us/img211/4563/examplejb4.jpg
here is my code so you see what im doing it with
//logtest.java
import java.util.*;
import java.io.*;
public class logtest
public static void main(String[] args)
FileOutputStream out;
PrintStream p = null;
boolean quit = false;
String fileName = "", fileLine = "", date = "", classes = "";
Scanner file = null;
Scanner s = new Scanner(System.in);
double exitword, sample;
System.out.print ("Enter the date: ");
date = s.nextLine();
while (!quit)
System.out.print ("Enter a filename: ");
fileName = s.nextLine();
if (fileName.equals("quit"))
System.exit(0);
else
try
out = new FileOutputStream(fileName, true);
p = new PrintStream( out );
catch (Exception e)
System.out.println ("Error writing to file");
System.exit(-1);
System.out.print ("What classes are you doing? : ");
classes = s.nextLine();
p.print( date + " ");
p.print(classes + " ");
p.println ( "" );
p.close();
}thanks
Edited by: kingryanj on Feb 23, 2008 11:36 AMi have examples of that but i cant brake it up
// Fahrenheit.java Author: Lewis/Loftus
// Demonstrates the use of text fields.
import javax.swing.JFrame;
public class Fahrenheit
// Creates and displays the temperature converter GUI.
public static void main (String[] args)
JFrame frame = new JFrame ("Fahrenheit");
frame.setDefaultCloseOperation (JFrame.EXIT_ON_CLOSE);
FahrenheitPanel panel = new FahrenheitPanel();
frame.getContentPane().add(panel);
frame.pack();
frame.setVisible(true);
}the panel part
// FahrenheitPanel.java Author: Lewis/Loftus
// Demonstrates the use of text fields.
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
public class FahrenheitPanel extends JPanel
private JLabel inputLabel, outputLabel, resultLabel;
private JTextField fahrenheit;
// Constructor: Sets up the main GUI components.
public FahrenheitPanel()
inputLabel = new JLabel ("Enter Fahrenheit temperature:");
outputLabel = new JLabel ("Temperature in Celsius: ");
resultLabel = new JLabel ("---");
fahrenheit = new JTextField (5);
fahrenheit.addActionListener (new TempListener());
add (inputLabel);
add (fahrenheit);
add (outputLabel);
add (resultLabel);
setPreferredSize (new Dimension(300, 75));
setBackground (Color.yellow);
// Represents an action listener for the temperature input field.
private class TempListener implements ActionListener
// Performs the conversion when the enter key is pressed in
// the text field.
public void actionPerformed (ActionEvent event)
int fahrenheitTemp, celsiusTemp;
String text = fahrenheit.getText();
fahrenheitTemp = Integer.parseInt (text);
celsiusTemp = (fahrenheitTemp-32) * 5/9;
resultLabel.setText (Integer.toString (celsiusTemp));
} -
How can I validate a dropdown box to NOT accept the default value?
I have a fillable form where I need the user to select their "Number of Employees". I have added several ranges as their options in a dropdown box (1-10, 11-25, 26-50, 50+). My issue is the "defult value" is set to "1-10" and people submit it without changing it to the correct value.
I have changed the default value to "--Select One--", but it still lets them submit the form with that value entered.
I am assuming I need some sort of validation script that will basically say - "If the value in this field is --Select One-- do not submit the form, but give an error that says 'please select your number of employees" or something along those lines.
Basically I just want them to pick something as opposed to just submiting it with the default value.
I have looked all over and am not very good with JS.You can not have the default value set to a real possible value. You need a value that should be selected.
Then for your submit script you need to test all of your required fields to make sure they are not at the default value.
You make a variable that assumes all the required fields are completed and then check each field and if any one still has the default value you set your variable to "false" and then when you have checked all the fields you test your variable's value and only if it is true to you submit the form.
var bSumbit = ture; // logical variable for submission test
// test drop down # of employess
this.getField("Number of Employees".).required = false; // clear required property
if(this.getField("Number of Employees".).value == "--Select One--") {
bSubmit = false;
this.getField("Number of Employees".).required = true; // set required property
if(bSubmit) {
// your submit acation;
} else {
app.alert("Not all required fields properly completed", 0, 1); -
How to add record in List Box in Screen Painter(SE51) ?
I am not able to add record in List box in Screen Painter using se51 Transaction code.
Regards,
Nirav DesaiDear All,
I found the solution.
If you are facing same problem , follow the bellow steps.
1. Declare in report.
TYPE-POOLS: VRM.
DATA: NAME TYPE VRM_ID,
LIST TYPE VRM_VALUES,
VALUE LIKE LINE OF LIST.
2. IN PBO Event.
clear: list.
NAME = 'TXT_PERIOD'. " your screen field name
VALUE-KEY = '1'.
VALUE-TEXT = 'LINE 1'.
APPEND VALUE TO LIST.
VALUE-KEY = '2'.
VALUE-TEXT = 'LINE 2'.
APPEND VALUE TO LIST.
VALUE-KEY = '3'.
VALUE-TEXT = 'LINE 3'.
APPEND VALUE TO LIST.
CALL FUNCTION 'VRM_SET_VALUES'
EXPORTING ID = NAME VALUES = LIST.
Regards,
Nirav Desai -
How to add an audio click box on a quiz slide - adobe captivate 6?
Hi,
I'm trying to add an audio click box on a question slide. It works brilliantly on normal slides but theres no option to add a click box on quiz slides.
I'm trying to add audio on click. So, when somebody clicks that area they will hear a sound. Is there a way to do this on a question slide?
ThanksReplace those old click boxes by shapes configured as buttons. Have a look at this post:
http://lilybiri.posterous.com/want-a-button-on-question-slide-in-captivate
Lilybiri -
How to add CheckBoxs to a scrollPane
I have a file I�m getting user info out of and finding certain information the
User enters, I�m making a query, I�m taking the found items and making an array of Checkboxes out of them witch is working my problem is adding the Checkboxes to the scroll Pane
public class Frame1 extends JFrame{
public static Panel listan = new Panel();
JCheckBox[] jCheckBox1 ;
JScrollPane scrollPane1 = new JScrollPane(list);
//other Window objects
//first method
private void jbInit() throws Exception {
//puts all window objects together
// Constructs user screen
list.setLayout(verticalFlowLayout1);
panel1.add(scrollPane1, new XYConstraints(118, 32, 128, 195));
// i have a find buttion that takes all infoamtion out of file
// and puts in an array then finds user enterd infomation
// this is just example code that just adds CheckBoxs to the scrollPane
// and is Basically the same way the other program does
// second method
void addcheckbox_actionPerformed(ActionEvent e) {
jCheckBox1 = new JCheckBox[50];
for (int i = 0; i < 50; i++) {
String checkboxText = ("Checkbox #: " + (i + 1));
jCheckBox1[i] = new JCheckBox(checkboxText);
for (int i = 0; i < 50; i++) {
list.add(jCheckBox1, null);
My problem is that I can�t add the checkboxes at the second method but it works in the first, I can add in the first because I initialize in the second.If you want something to compile here is all my example code
I will incorporate it to my 30 page program
Here is what I want my code to do
package list;
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
import com.borland.jbcl.layout.*;
import java.awt.Checkbox;
* <p>Title: </p>
* <p>Description: </p>
* <p>Copyright: Copyright (c) 2008</p>
* <p>Company: </p>
* @author not attributable
* @version 1.0
public class Frame1 extends JFrame {
public static boolean ch=true;
JPanel contentPane;
GridLayout gridLayout1 = new GridLayout();
JPanel panel1 = new JPanel();
XYLayout xYLayout1 = new XYLayout();
JButton jButton1;
JButton jButton2;
JButton addcheckbox;
JCheckBox[] jCheckBox1 ;
JScrollPane scrollPane1 = new JScrollPane();
JPanel list = new JPanel();
VerticalFlowLayout verticalFlowLayout1 = new VerticalFlowLayout();
//Construct the frame
public Frame1() {
enableEvents(AWTEvent.WINDOW_EVENT_MASK);
try {
jbInit();
catch (Exception e) {
e.printStackTrace();
//Component initialization
// method one
private void jbInit() throws Exception {
contentPane = (JPanel)this.getContentPane();
jButton1 = new JButton();
jButton2 = new JButton();
addcheckbox = new JButton();
this.setContentPane(contentPane);
this.setLocale(java.util.Locale.getDefault());
this.setResizable(false);
this.setSize(new Dimension(400, 300));
this.setState(Frame.NORMAL);
this.setTitle("Frame Title");
contentPane.setOpaque(true);
contentPane.setRequestFocusEnabled(true);
contentPane.setLayout(gridLayout1);
panel1.setLayout(xYLayout1);
jButton1.setSelected(false);
jButton1.setText("Print");
jButton1.addActionListener(new Frame1_jButton1_actionAdapter(this));
jButton2.setText("select all/none");
jButton2.addActionListener(new Frame1_jButton2_actionAdapter(this));
addcheckbox.setBorderPainted(true);
addcheckbox.setText("add");
addcheckbox.addActionListener(new Frame1_addcheckbox_actionAdapter(this));
scrollPane1.setLocale(java.util.Locale.getDefault());
list.setLayout(verticalFlowLayout1);
contentPane.add(panel1, null);
panel1.add(scrollPane1, new XYConstraints(118, 32, 128, 195));
scrollPane1.getViewport().add(list, null);
//scrollPane1.add(listan, null);
panel1.add(jButton1, new XYConstraints(261, 92, 90, 39));
panel1.add(jButton2, new XYConstraints(262, 152, 108, 30));
panel1.add(addcheckbox, new XYConstraints(25, 49, -1, 35));
//Overridden so we can exit when window is closed
protected void processWindowEvent(WindowEvent e) {
super.processWindowEvent(e);
if (e.getID() == WindowEvent.WINDOW_CLOSING) {
System.exit(0);
void jButton1_actionPerformed(ActionEvent e) {
String checkprint = "selected:\n";
for (int x = 0; x < jCheckBox1.length; x++) {
if (jCheckBox1[x].isSelected()) {
checkprint = checkprint + jCheckBox1[x].getText()+"\n";
System.out.println(checkprint);
void jButton2_actionPerformed(ActionEvent e) {
for (int x = 0; x < jCheckBox1.length; x++) {
if (ch == true) {
jCheckBox1[x].setSelected(true);
else{
jCheckBox1[x].setSelected(false);
if (ch == true)
ch=false;
else
ch=true;
//method two
void addcheckbox_actionPerformed(ActionEvent e) {
jCheckBox1 = new JCheckBox[50];
for (int i = 0; i < 50; i++) {
String checkboxText = ("Checkbox #: " + (i + 1));
jCheckBox1[i] = new JCheckBox(checkboxText);
for (int i = 0; i < 50; i++) {
list.add(jCheckBox1, null);
class Frame1_jButton1_actionAdapter implements java.awt.event.ActionListener {
Frame1 adaptee;
Frame1_jButton1_actionAdapter(Frame1 adaptee) {
this.adaptee = adaptee;
public void actionPerformed(ActionEvent e) {
adaptee.jButton1_actionPerformed(e);
class Frame1_jButton2_actionAdapter implements java.awt.event.ActionListener {
Frame1 adaptee;
Frame1_jButton2_actionAdapter(Frame1 adaptee) {
this.adaptee = adaptee;
public void actionPerformed(ActionEvent e) {
adaptee.jButton2_actionPerformed(e);
class Frame1_addcheckbox_actionAdapter implements java.awt.event.ActionListener {
Frame1 adaptee;
Frame1_addcheckbox_actionAdapter(Frame1 adaptee) {
this.adaptee = adaptee;
public void actionPerformed(ActionEvent e) {
adaptee.addcheckbox_actionPerformed(e);
}doesn�t work but if I take all of method two and put it in one it workspackage list;
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
import com.borland.jbcl.layout.*;
import java.awt.Checkbox;
* <p>Title: </p>
* <p>Description: </p>
* <p>Copyright: Copyright (c) 2008</p>
* <p>Company: </p>
* @author not attributable
* @version 1.0
public class Frame1 extends JFrame {
public static boolean ch=true;
JPanel contentPane;
GridLayout gridLayout1 = new GridLayout();
JPanel panel1 = new JPanel();
XYLayout xYLayout1 = new XYLayout();
JButton jButton1;
JButton jButton2;
JButton addcheckbox;
JCheckBox[] jCheckBox1 ;
JScrollPane scrollPane1 = new JScrollPane();
JPanel list = new JPanel();
VerticalFlowLayout verticalFlowLayout1 = new VerticalFlowLayout();
//Construct the frame
public Frame1() {
enableEvents(AWTEvent.WINDOW_EVENT_MASK);
try {
jbInit();
catch (Exception e) {
e.printStackTrace();
//Component initialization
private void jbInit() throws Exception {
// this is the same code in method two
jCheckBox1 = new JCheckBox[50];
for (int i = 0; i < 50; i++) {
String checkboxText = ("Checkbox #: " + (i + 1));
jCheckBox1[i] = new JCheckBox(checkboxText);
for (int i = 0; i < 50; i++) {
list.add(jCheckBox1[i], null);
contentPane = (JPanel)this.getContentPane();
jButton1 = new JButton();
jButton2 = new JButton();
addcheckbox = new JButton();
this.setContentPane(contentPane);
this.setLocale(java.util.Locale.getDefault());
this.setResizable(false);
this.setSize(new Dimension(400, 300));
this.setState(Frame.NORMAL);
this.setTitle("Frame Title");
contentPane.setOpaque(true);
contentPane.setRequestFocusEnabled(true);
contentPane.setLayout(gridLayout1);
panel1.setLayout(xYLayout1);
jButton1.setSelected(false);
jButton1.setText("Print");
jButton1.addActionListener(new Frame1_jButton1_actionAdapter(this));
jButton2.setText("select all/none");
jButton2.addActionListener(new Frame1_jButton2_actionAdapter(this));
addcheckbox.setBorderPainted(true);
addcheckbox.setText("add");
addcheckbox.addActionListener(new Frame1_addcheckbox_actionAdapter(this));
scrollPane1.setLocale(java.util.Locale.getDefault());
list.setLayout(verticalFlowLayout1);
contentPane.add(panel1, null);
panel1.add(scrollPane1, new XYConstraints(118, 32, 128, 195));
scrollPane1.getViewport().add(list, null);
//scrollPane1.add(listan, null);
panel1.add(jButton1, new XYConstraints(261, 92, 90, 39));
panel1.add(jButton2, new XYConstraints(262, 152, 108, 30));
panel1.add(addcheckbox, new XYConstraints(25, 49, -1, 35));
//Overridden so we can exit when window is closed
protected void processWindowEvent(WindowEvent e) {
super.processWindowEvent(e);
if (e.getID() == WindowEvent.WINDOW_CLOSING) {
System.exit(0);
void jButton1_actionPerformed(ActionEvent e) {
String checkprint = "selected:\n";
for (int x = 0; x < jCheckBox1.length; x++) {
if (jCheckBox1[x].isSelected()) {
checkprint = checkprint + jCheckBox1[x].getText()+"\n";
System.out.println(checkprint);
void jButton2_actionPerformed(ActionEvent e) {
for (int x = 0; x < jCheckBox1.length; x++) {
if (ch == true) {
jCheckBox1[x].setSelected(true);
else{
jCheckBox1[x].setSelected(false);
if (ch == true)
ch=false;
else
ch=true;
void addcheckbox_actionPerformed(ActionEvent e) {
class Frame1_jButton1_actionAdapter implements java.awt.event.ActionListener {
Frame1 adaptee;
Frame1_jButton1_actionAdapter(Frame1 adaptee) {
this.adaptee = adaptee;
public void actionPerformed(ActionEvent e) {
adaptee.jButton1_actionPerformed(e);
class Frame1_jButton2_actionAdapter implements java.awt.event.ActionListener {
Frame1 adaptee;
Frame1_jButton2_actionAdapter(Frame1 adaptee) {
this.adaptee = adaptee;
public void actionPerformed(ActionEvent e) {
adaptee.jButton2_actionPerformed(e);
class Frame1_addcheckbox_actionAdapter implements java.awt.event.ActionListener {
Frame1 adaptee;
Frame1_addcheckbox_actionAdapter(Frame1 adaptee) {
this.adaptee = adaptee;
public void actionPerformed(ActionEvent e) {
adaptee.addcheckbox_actionPerformed(e);
}Edited by: deme on Feb 27, 2008 6:48 AM
Edited by: deme on Feb 27, 2008 6:51 AM
Maybe you are looking for
-
Can't print large documents.
For years, we've been printing large documents to our plotter without issue. Suddenly last week, nothing large will print. I've seen a few different error messages, and have tried different computers, and different versions of Illustrator, but nothi
-
Error Loading External Library - worked on 10g, now upgraded to 11g and not
I have an external C library that have been using for years to extracy binary data (images, docs, pdfs etc) from a blob column in a table This has been working on Oracle 10.2.0.1 on Windows 32 bit for years. I have a new server, Windows 2008 64 bit,
-
Upon downloading the 4.0 version of your firefox, I have no longer been able to access downloads as they do not appear in the downloads folder (ie- pdf's etc).
-
Besides Maya, is there another Motion Software for Autocad2015
esides Maya, is there another Motion Software for Autocad2015
-
Please assist with this little puzzle. Imagine 2 tables... Products and Stock tables. Products has columns: Product_no Site Status Stock has columns: Product_no Site Location Qty_on_hand Sample data: Products: 1000,MFG,A 1000,SRV,D 1000,DEM,A 1001,SR