Dynamic jmenu bar
i have a dynamic JMenu on a jframe. The menu is populated by looking up database entries and ptting them into the right place. This is done by a method 'menus()'.
I also have an addingredients class which adds new ingredient entries into the database, problem is when it does this, the JMenu has to be repopulated. The following code shows the main frame
// Recipe Creation GUI
// Written by Michael Emett
// Monday 15th Decemeber 2003
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
import javax.swing.JFrame.*;
import java.sql.*;
import java.util.*;
public class TextAreaDemo extends JFrame {
private static JTextArea part1;
private JButton Browse, Enter, Preview, Remove;
public static JList printList, newList;
private JCheckBox pic;
private JLabel namePrompt, title1, title2, title3;
private static JTextField nameInput;
private JPanel jp, jp1, jp2, jp3, jp4, jp5;
private Connection con;
private Statement stmt;
public static JMenu fileMenu;
private static JMenuBar bar;
// additions /////////////////////////////////////////////////////////////////////////
//set up GUI
public TextAreaDemo() {
super( "Recipe Entry Sheet" );
// set up File menu and its menu items
// Menu and button Initialization ////////////////////////////////////////////////////
//myMouse = new MyMouseAdapter();
//final JMenu
fileMenu = new JMenu( "Ingredients");
fileMenu.setMnemonic( 'I' );
fileMenu.add(menus());
bar = new JMenuBar();
setJMenuBar( bar );
JMenu file = new JMenu( "File");
file.setMnemonic( 'F' );
bar.add(file);
JMenuItem Adder = new JMenuItem( "New Ingredient");
Adder.setMnemonic( 'N' );
JMenuItem Subber = new JMenuItem( "New subMenu");
Subber.setMnemonic( 'S' );
// set up About... menu item
JMenuItem aboutItem = new JMenuItem( "About..." );
aboutItem.setMnemonic( 'A' );
namePrompt = new JLabel( "Recipe Name " );
nameInput = new JTextField( 20 );
title1 = new JLabel( "Selected ingredients" );
title3 = new JLabel( "Please enter the Recipe Instructions" );
title2 = new JLabel( "Enter The SubMenu Name " );
pic = new JCheckBox("Add Picture", false);
file.add( Adder );
Adder.addActionListener(
new ActionListener() {
public void actionPerformed( ActionEvent event )
getList f = new getList();
// Add Ingredient menu item //////////////////////////////////////////////////////////
file.add( Subber );
Subber.addActionListener(
new ActionListener() {
public void actionPerformed( ActionEvent event )
AddSubMenu f = new AddSubMenu();
// About menu item ///////////////////////////////////////////////////////////////////
file.add( aboutItem );
aboutItem.addActionListener(
new ActionListener() { // anonymous inner class
// display message dialog when user selects About...
public void actionPerformed( ActionEvent event )
JOptionPane.showMessageDialog( TextAreaDemo.this,
"Developed by Michael Emett, 2004",
"About", JOptionPane.PLAIN_MESSAGE );
} // end anonymous inner class
); // end call to addActionListener
// Exit menu item ////////////////////////////////////////////////////////////////////
JMenuItem exitItem = new JMenuItem( "Exit" );
exitItem.setMnemonic( 'x' );
file.add( exitItem );
exitItem.addActionListener(
new ActionListener() { // anonymous inner class
// terminate application when user clicks exitItem
public void actionPerformed( ActionEvent event )
System.exit( 0 );
} // end anonymous inner class
); // end call to addActionListener
//create Button Enter
Enter = new JButton("Enter");
Enter.addActionListener(
new ActionListener() {
public void actionPerformed( ActionEvent event )
StringBuffer a = new StringBuffer();
StringBuffer b = new StringBuffer();
StringBuffer c = new StringBuffer();
for(int i= 0; i< victor.size(); i++){
b.append(victor.elementAt(i));
b.append("; ");
a.append(nameInput.getText());
c.append(part1.getText());
//System.out.println(a);
//System.out.println(b);
//System.out.println(c);
InsertRecipe f = new InsertRecipe(a,b,c);
//invalidate();
//fileMenu.updateUI();
// fileMenu.revalidate();
//create Button Remove
Remove = new JButton("Remove");
//add Actionlistener
Remove.addActionListener(
new ActionListener() {
public void actionPerformed( ActionEvent event )
int[] arr;
arr = printList.getSelectedIndices();
int counter = 0;
for (int i= 0; i< arr.length; i++){
int n=arr;
victor.remove(n-counter);
counter++;
printList.setListData(victor);
//create Button Remove
Browse = new JButton("Browse");
//create Button Preview
Preview = new JButton("Clear");
Preview.addActionListener(
new ActionListener() { // anonymous inner class
// display message dialog when user selects Preview...
public void actionPerformed( ActionEvent event )
int result = JOptionPane.showConfirmDialog
(null, "Are you sure to want to clear this form", "Clear?", JOptionPane.YES_NO_OPTION, JOptionPane.PLAIN_MESSAGE);
if(result == JOptionPane.YES_OPTION)
{TextAreaDemo.clear();
//System.out.println("Recipe Entered");
}//end of joptionpane
printList = new JList();
printList.setVisibleRowCount(9);
printList.setFixedCellWidth(150);
printList.setFixedCellHeight(15);
printList.setSelectionMode(ListSelectionModel.MULTIPLE_INTERVAL_SELECTION );
newList = new JList();
newList.setVisibleRowCount(9);
newList.setFixedCellWidth(150);
newList.setFixedCellHeight(15);
newList.setSelectionMode(ListSelectionModel.SINGLE_INTERVAL_SELECTION );
// Initialise Text Areas //
part1 = new JTextArea( 25, 50);
part1.setFont(new Font("Courier", Font.BOLD, 12));
part1.setLineWrap(true);
part1.setWrapStyleWord(true);
// JPanels for Layout //
jp = new JPanel();
jp1 = new JPanel();
jp2 = new JPanel();
jp3 = new JPanel();
jp4 = new JPanel();
jp5 = new JPanel();
final Container c = getContentPane();
GridBagLayout gbl = new GridBagLayout();
GridBagConstraints gbc = new GridBagConstraints();
c.setLayout(gbl);
gbc.weightx = 0.1;
gbc.weighty = 0.5;
gbc.fill = GridBagConstraints.NONE;
gbc.anchor = GridBagConstraints.NORTHWEST;
add(jp1, gbc, 0, 0, 1, 1);
gbc.fill = GridBagConstraints.NONE;
add(jp2, gbc, 0, 1, 1, 1);
add(jp3, gbc, 1, 0, 2, 2);
jp1.add(jp4, BorderLayout.CENTER);
jp2.add(jp, BorderLayout.CENTER);
bar.add( namePrompt );
bar.add( nameInput);
bar.add( fileMenu );
jp4.setLayout(new BorderLayout());
jp4.add(title1, BorderLayout.NORTH);
jp4.add(new JScrollPane( printList), BorderLayout.CENTER);
jp4.add(Remove, BorderLayout.SOUTH);
jp.setLayout(new BorderLayout());
jp.add(pic, BorderLayout.NORTH);
jp.add(new JScrollPane (newList), BorderLayout.CENTER);
jp.add(Browse, BorderLayout.SOUTH);
jp3.setLayout(new BorderLayout());
jp3.add (title3, BorderLayout.NORTH);
jp3.add (new JScrollPane(part1), BorderLayout.CENTER);
//c.addMouseListener(myMouse);
gbc.anchor = GridBagConstraints.LAST_LINE_END;
add(jp5, gbc, 2, 3, 1, 1);
jp5.setLayout(new FlowLayout());
jp5.add(Preview);
jp5.add(Enter);
setSize(770, 620);
pack();
setVisible(true);
setResizable(false);
private static Vector victor = new Vector();
public static void printListset(String t) {
victor.add(t);
for(int i = 0; i<victor.size(); i++)
printList.setListData(victor);
public void add(Component ce, GridBagConstraints constraints, int x, int y, int w, int h) {
constraints.gridx = x;
constraints.gridy = y;
constraints.gridwidth = w;
constraints.gridheight = h;
getContentPane().add(ce, constraints);
public static JMenu menus() {
// Map Created to Handle JMenuItem Addition //
Map labelToMenu = new HashMap();
Map labelToMenu2 = new HashMap();
Map labelToMenu3 = new HashMap();
String url = "jdbc:odbc:database";
Connection con;
Statement stmt;
try {
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
catch(ClassNotFoundException e) {
System.err.print("Class Not found");
String query = "select baseIngred.IngredientType, baseIngred.PrimaryKey FROM baseIngred";
String query2 = "select baseIngred.IngredientType, baseIngred.PrimaryKey,"
+ "subMenu.menuNumber, subMenu.subMenu FROM baseIngred, "
+ "subMenu WHERE baseIngred.PrimaryKey = subMenu.menuNumber ORDER BY submenu";
String query3 = "select subMenu.subMenu, subMenu.PrimaryNumber,"
+ "Ingredient.Ingredient, Ingredient.MenuNumber FROM subMenu, Ingredient"
+ " WHERE Ingredient.MenuNumber = subMenu.PrimaryNumber ORDER BY PrimaryNumber";
String query4 = "select Ingredient.Ingredient, Ingredient.MenuNumber FROM Ingredient";
try {
con = DriverManager.getConnection(url, "myLogin", "myPassword");
stmt = con.createStatement();
// Initial Jmenu added ///////////////////////////////////////////////////////////////
ResultSet rs = stmt.executeQuery(query);
String[] arr = new String[100];
int[] num = new int[200];
int[] num2 = new int[200];
int counter = 0;
int counter2 = 0;
while (rs.next()) {
//String t is set to the value contained in ingredient type
String t = rs.getString("IngredientType");
//map labelToMenu has String t and a new JMenu with the menu
//name contained in t stored in it
labelToMenu.put(t, fileMenu.add(new JMenu(t)));
//an array containing values of the priamry key is produced
num[counter] = rs.getInt("PrimaryKey");
//a counter is incremeted so that upon further
//interations it is stored in a new array field
counter++;
// Second Jmenu added ////////////////////////////////////////////////////////////////
ResultSet rs2 = stmt.executeQuery(query2);
while (rs2.next()) {
//String first is set to the value contained in ingredient type
String first = rs2.getString("IngredientType");
//String second is set to the value contained in subMenu
String second = rs2.getString("subMenu");
//firstlevel looks up item t in the map, and creates a jmenu name as it.
JMenu firstLevel = (JMenu)labelToMenu.get(first);
//handles menu placement by comparing PrimaryKeys with MenuNumbers
// f = rs2.getInt("menuNumber");
num2[counter2] = rs2.getInt("menuNumber");
for (int nm = 0; nm<num.length; nm++){
if (num[nm] == num2[counter2]
//adds the second value to the jmenu with th name stored in t.
labelToMenu2.put(second, (firstLevel.add(new JMenu (second))));
}counter2++;
// Third JMenu added /////////////////////////////////////////////////////////////////
ResultSet rs3 = stmt.executeQuery(query3);
while (rs3.next()) {
//String next is set to the value contained in subMenu
String next = rs3.getString("subMenu");
//String third is set to the value contained in ingredient
String third = rs3.getString("Ingredient");
JMenu secondLevel = (JMenu)labelToMenu2.get(next);
int f2 = rs3.getInt("MenuNumber");
//System.out.println(f2);
int f3 = rs3.getInt("PrimaryNumber");
if (f3 == f2){
labelToMenu3.put(third, secondLevel.add(new JMenuItem(third)));
// Add AtionListeners ////////////////////////////////////////////////////////////////
ResultSet rs4 = stmt.executeQuery(query4);
while (rs4.next()) {
String third2 = rs4.getString("Ingredient");
JMenuItem thirdLevel = (JMenuItem)labelToMenu3.get(third2);
thirdLevel.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
JMenuItem source = (JMenuItem)(e.getSource());
String actionText = source.getText();
PopUp pop = new PopUp(actionText);
stmt.close();
con.close();
}catch(SQLException ex) {
System.err.println(ex);
return (fileMenu);
// End Of Connection //
// Add subMenu menu item /////////////////////////////////////////////////////////////
public static void clear() {
nameInput.setText("");
victor.removeAllElements();
printList.setListData(victor);
part1.setText("");
public static void rebuild() {
fileMenu.removeAll();
fileMenu.add(menus());
bar.add( fileMenu );
public static void main(String args[]) {
TextAreaDemo t = new TextAreaDemo();
t.setDefaultCloseOperation( JFrame.EXIT_ON_CLOSE);
the code inside the method 'rebuild()' will work from inside the main JFrame body if assigned to a button (such as the example position denoted by HERE in the code), but that is undesirable as it requires the user to refresh manually every time they add a new ingredient. what i need is a method that can be called from another class/method/whatever.
thankyou for any help you can offer, it is much appreciated
The code you offered did not solve my problem. I have since entered the followinginto the actionlistener of a button on the JFrame,
refreshMenu = new JButton("Refresh Menu");
refreshMenu.addActionListener(
new ActionListener() {
// display message dialog when user selects Preview...
public void actionPerformed( ActionEvent event )
fileMenu.removeAll();
fileMenu.add(menus());
bar.add( fileMenu );
);This does what i need, but i need these statements to be made from an external class, not a JButton,
Similar Messages
-
Dynamic Text Feild with Dynamic Scroll Bar
I have a Dynamic Text Feild with a dynamic Scroll bar.
It loads a simple ASCI text file with some html formating.
but I still can not manage to get the text to format.
The biggest problem with the format is a big space between
paragraphs.
I am not sure why but I think the Frame must need a var to
render to html.
Can anybody help please?My text had the following, similar but no parsing string.
I guess
yourstring.split("\n\r").join("\r").split("\r\n").join("\r");
takes out the carrage returns or <br>?
I notice the one I had just say's String.
I assume that would be the text that is the string?
Thank you for sharing your knowledge of this.
var my_lv:LoadVars = new LoadVars();
my_lv.onData = function(src:String) {
if (src != undefined) {
myTxtFeild.text = src;
} else {
myTxtFile.text = "Error loading text.";
my_lv.load("CadnetPage1_html.txt"); -
Hi
experts , can any body tell me how to create dynamic title bar in interactive report
,i.e, suppose we have 17 pages,every page should contain the same heading,
and i have one more question
what are the mandatory things required in data Dictionary for creating table.top-of-page triggers after every right statement triggers
in basic list,
top-of-page during line selection triggers after every
secondary list display........
see the simple example code :
REPORT ZTEJ_INTAB1 LINE-SIZE 103 LINE-COUNT 35(5) NO STANDARD PAGE
HEADING.
*TABLES DECLARATION
TABLES : KNA1, VBAK, VBAP.
*SELECT OPTIONS
SELECT-OPTIONS: CUST_NO FOR KNA1-KUNNR.
*INITIALIZATION
INITIALIZATION.
CUST_NO-LOW = '01'.
CUST_NO-HIGH = '5000'.
CUST_NO-SIGN = 'I'.
CUST_NO-OPTION = 'BT'.
APPEND CUST_NO.
*SELECTION SCREEN VALIDATION
AT SELECTION-SCREEN ON CUST_NO.
IF CUST_NO-LOW < 1 OR CUST_NO-HIGH > 5000.
MESSAGE E001(ZTJ1).
ENDIF.
*BASIC LIST SELECTION
START-OF-SELECTION.
SELECT KUNNR NAME1 ORT01 LAND1 INTO
(KNA1-KUNNR, KNA1-NAME1,KNA1-ORT01,KNA1-LAND1)
FROM KNA1
WHERE KUNNR IN CUST_NO.
WRITE:/1 SY-VLINE,
KNA1-KUNNR UNDER 'CUSTOMER NO.' HOTSPOT ON,
16 SY-VLINE,
KNA1-NAME1 UNDER 'NAME',
61 SY-VLINE,
KNA1-ORT01 UNDER 'CITY',
86 SY-VLINE,
KNA1-LAND1 UNDER 'COUNTRY',
103 SY-VLINE.
HIDE: KNA1-KUNNR.
ENDSELECT.
ULINE.
*SECONDARY LIST ACCESS
AT user-command.
IF SY-UCOMM = 'IONE'.
PERFORM SALES_ORD.
ENDIF.
IF SY-UCOMM = 'ITWO'.
PERFORM ITEM_DET.
ENDIF.
*TOP OF PAGE
TOP-OF-PAGE.
FORMAT COLOR 1.
WRITE : 'CUSTOMER DETAILS'.
FORMAT COLOR 1 OFF.
ULINE.
FORMAT COLOR 3.
WRITE : 1 SY-VLINE,
3 'CUSTOMER NO.',
16 SY-VLINE,
18 'NAME',
61 SY-VLINE,
63 'CITY',
86 SY-VLINE,
88 'COUNTRY',
103 SY-VLINE.
ULINE.
FORMAT COLOR 3 OFF.
*TOP OF PAGE FOR SECONDARY LISTS
TOP-OF-PAGE DURING LINE-SELECTION.
*TOP OF PAGE FOR 1ST SECONDARY LIST
IF SY-UCOMM = 'IONE'.
ULINE.
FORMAT COLOR 1.
WRITE : 'SALES ORDER DETAILS'.
ULINE.
FORMAT COLOR 1 OFF.
FORMAT COLOR 3.
WRITE : 1 SY-VLINE,
3 'CUSTOMER NO.',
16 SY-VLINE,
18 'SALES ORDER NO.',
40 SY-VLINE,
42 'DATE',
60 SY-VLINE,
62 'CREATOR',
85 SY-VLINE,
87 'DOC DATE',
103 SY-VLINE.
ULINE.
ENDIF.
FORMAT COLOR 3 OFF.
*TOP OF PAGE FOR 2ND SECONDARY LIST
IF SY-UCOMM = 'ITWO'.
ULINE.
FORMAT COLOR 1.
WRITE : 'ITEM DETAILS'.
ULINE.
FORMAT COLOR 1 OFF.
FORMAT COLOR 3.
WRITE : 1 SY-VLINE,
3 'SALES ORDER NO.',
40 SY-VLINE,
42 'SALES ITEM NO.',
60 SY-VLINE,
62 'ORDER QUANTITY',
103 SY-VLINE.
ULINE.
ENDIF.
FORMAT COLOR 3 OFF.
*END OF PAGE
END-OF-PAGE.
ULINE.
WRITE :'USER :',SY-UNAME,/,'DATE :', SY-DATUM, 85 'END OF PAGE:',
SY-PAGNO.
SKIP.
*& Form SALES_ORD
*& FIRST SECONDARY LIST FORM
FORM SALES_ORD .
SELECT KUNNR VBELN ERDAT ERNAM AUDAT INTO
(VBAK-KUNNR, VBAK-VBELN, VBAK-ERDAT, VBAK-ERNAM, VBAK-AUDAT)
FROM VBAK
WHERE KUNNR = KNA1-KUNNR.
WRITE:/1 SY-VLINE,
VBAK-KUNNR UNDER 'CUSTOMER NO.' HOTSPOT ON,
16 SY-VLINE,
VBAK-VBELN UNDER 'SALES ORDER NO.' HOTSPOT ON,
40 SY-VLINE,
VBAK-ERDAT UNDER 'DATE',
60 SY-VLINE,
VBAK-ERNAM UNDER 'CREATOR',
85 SY-VLINE,
VBAK-AUDAT UNDER 'DOC DATE',
103 SY-VLINE.
HIDE : VBAK-VBELN.
ENDSELECT.
ULINE.
ENDFORM. " SALES_ORD
*& Form ITEM_DET
*& SECOND SECONDARY LIST FORM
FORM ITEM_DET .
SELECT VBELN POSNR KWMENG INTO
(VBAP-VBELN, VBAP-POSNR, VBAP-KWMENG)
FROM VBAP
WHERE VBELN = VBAK-VBELN.
WRITE : /1 SY-VLINE,
VBAP-VBELN UNDER 'SALES ORDER NO.',
40 SY-VLINE,
VBAP-POSNR UNDER 'SALES ITEM NO.',
60 SY-VLINE,
VBAP-KWMENG UNDER 'ORDER QUANTITY',
103 SY-VLINE.
ENDSELECT.
ULINE.
ENDFORM. " ITEM_DET
REPORT demo_list_at_pf.
START-OF-SELECTION.
WRITE 'Basic List, Press PF5, PF6, PF7, or PF8'.
AT pf5.
PERFORM out.
AT pf6.
PERFORM out.
AT pf7.
PERFORM out.
AT pf8.
PERFORM out.
FORM out.
WRITE: 'Secondary List by PF-Key Selection',
/ 'SY-LSIND =', sy-lsind,
/ 'SY-UCOMM =', sy-ucomm.
ENDFORM.
After executing the program, the system displays the basic list. The user can press the function keys F5 , F6 , F7 , and F8 to create secondary lists. If, for example, the 14th key the user presses is F6 , the output on the displayed secondary list looks as follows:
Secondary List by PF-Key Selection
SY-LSIND = 14
SY-UCOMM = PF06
Example for AT USER-COMMAND
START-OF-SELECTION.
WRITE: 'Basic List',
/ 'SY-LSIND:', sy-lsind.
TOP-OF-PAGE.
WRITE 'Top-of-Page'.
ULINE.
TOP-OF-PAGE DURING LINE-SELECTION.
CASE sy-pfkey.
WHEN 'TEST'.
WRITE 'Self-defined GUI for Function Codes'.
ULINE.
ENDCASE.
AT LINE-SELECTION.
SET PF-STATUS 'TEST' EXCLUDING 'PICK'.
PERFORM out.
sy-lsind = sy-lsind - 1.
AT USER-COMMAND.
CASE sy-ucomm.
WHEN 'FC1'.
PERFORM out.
WRITE / 'Button FUN 1 was pressed'.
WHEN 'FC2'.
PERFORM out.
WRITE / 'Button FUN 2 was pressed'.
WHEN 'FC3'.
PERFORM out.
WRITE / 'Button FUN 3 was pressed'.
WHEN 'FC4'.
PERFORM out.
WRITE / 'Button FUN 4 was pressed'.
WHEN 'FC5'.
PERFORM out.
WRITE / 'Button FUN 5 was pressed'.
ENDCASE.
sy-lsind = sy-lsind - 1.
FORM out.
WRITE: 'Secondary List',
/ 'SY-LSIND:', sy-lsind,
/ 'SY-PFKEY:', sy-pfkey.
ENDFORM.
When you run the program, the system displays the following basic list with a the page header defined in the program:
You can trigger the AT LINE-SELECTION event by double-clicking a line. The system sets the status TEST and deactivates the function code PICK. The status TEST contains function codes FC1 to FC5. These are assigned to pushbuttons in the application toolbar. The page header of the detail list depends on the status.
Here, double-clicking a line no longer triggers an event. However, there is now an application toolbar containing five user-defined pushbuttons. You can use these to trigger the AT USER-COMMAND event. The CASE statement contains a different reaction for each pushbutton.
For each interactive event, the system decreases the SY-LSIND system field by one, thus canceling out the automatic increase. All detail lists now have the same level as the basic list and thus overwrite it. While the detail list is being created, SY-LSIND still has the value 1.
Check with below links :
interactive report
http://www.erpgenie.com/abap/ireports.htm
http://www.erpgenie.com/sap/abap/example_code.htm
Check the below link and it explian about top-of-page during line-selection
http://www.sts.tu-harburg.de/teaching/sap_r3/ABAP4/top_of_p.htm
Mandatory thing for creation of table
1. Description of table
2. Delivery class
3 Table should have atelast one field ,should have one primary key
4. Data class ,size category
Thanks
Seshu -
I have created a jmenu bar but ho do i get the drop down list to select element is it done in the sae way as a normal list.
private void jMenu1ActionPerformed(java.awt.event.ActionEvent evt) {
// TODO add your handling code here:
}Shall i post this in a different forum
-
HI,
In swf file how to show a status bar with status messages
dynamically.
Thanks,
Suman PuliWhich Status Bar?
Post your question in the forum for Adobe Reader. -
Dynamic scroll bar not visible
I created my text in a text file (saved as testtext.txt),
then in Flash I added a dynamic text box (instance name: testtext)
and dragged a scrollbar component (instance name: ttscroll) onto
it. I then added this action script to the first frame:
ttscroll._visible = (testtext.maxscroll >1);
loadVariables("testtext.txt", this);
The text shows up fine, and scrolls if I put my mouse in the
text box and drag down. However, the scroll bar doesn't show up.
How do I get this to work?
Thanks.
PS Due to company policies I'm not allowed to download and
install anything, so I have to stick with what comes with Flash, so
please don't recommend I download someone else's scrollbar.My first guess is that you are testing for maxScroll before
the text is
actually loaded, so the test result is false.
You could use a listener for the loading function and let the
listener's
onLoadInit() event set the scrollbar.
Another option is to use a textArea component. It has an
automatic
scrollbar.
Rob
Rob Dillon
Adobe Community Expert
http://www.ddg-designs.com
412.243.9119 -
JMenu Bar does not show unless I resize the window
Hi, I have just a simple problem. I am trying to just have a blank JFrame with a JMenuBar at the top with the JMenu "File". I have the following code, but once I run the application it is just a blank frame with no Menus. Once I grab the frame and resize it with the mouse, it appears. What do I need to do to have the menu bar be shown once the application runs?
import javax.swing.*;
import java.awt.*;
class ProgramWindow extends JFrame
private JMenuBar jmb = new JMenuBar();
private JMenu file = new JMenu("File");
public ProgramWindow()
setSize(300, 300);
setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
setVisible(true);
setJMenuBar(jmb);
jmb.add(fileMenu);
Container c = getContentPane();
c.setBackground(Color.lightGray);
c.setLayout(new BorderLayout());
setConentPane(c);
public class Program
public static void main (String[] args)
ProgramWindow pw = new ProgramWindow();
}Normally you poop up and decorate frames/dialogs before you set them
visible. Otherwise you have to revalidate() them after you' ve added
some components to them. (resizing them does that for you as you have
noticed).
kind regards,
Jos -
I need to create a menu bar in a template that, when attached
to a page, will create a link to all the pages attached to that
page. I did this in frontpage with a "tool" but now I can't find
out how to do it in Dreamweaver.Call me curious, why aren't you using one of the pre-built CMS frameworks for this? WordPress, Drupal, Joomla, Concrete5... all lend themselves to this sort of thing without a lot of brain freeze.
PS. Dynamic (php/mysql) questions belong in the Developer's Forum where you'll receive better answers.
http://forums.adobe.com/community/dreamweaver/dreamweaver_development?view=discussions
Nancy O.
Alt-Web Design & Publishing
Web | Graphics | Print | Media Specialists
http://alt-web.com/
http://twitter.com/altweb -
I'm creating a page-turning module. Throughout the module
there is a progress bar that updates both visually and by
percentage how much of the module has been completed. I'm not sure
how to program this and help is appreciated. As you can see by the
mockup I have so far ( below) I've got the progress bar drawn and
the percentage completed as well as a dynamic text f ield. What I'm
wondering is how to make it update as the user goes forward (the
only direction they can go) through the frames.
http://distance.uaf.edu/mockup/FERPA-mockup-1.html
thanks!
sagewell, you could get the percentage by dividing current pages
they have been through by the total quantity of pages in the doc
and multiply by 100. And if this is more dynamic (pages get added
or taken out) but it's based on 'one frame per page' then you could
use the _currentframe and _totalframes, within the same type of
formula to derive the progress percentage.
you can then advance the 'bar' by: first drawing a bar that
fills the whole area, at 100%, make it a moive clip, then using the
calculation you decide on to obtain the percentage, you can use the
_xscale property, on the 'bar' to scale it to the current
percentage of progress (set it to 0 at the start). -
Can a bar chart grow dynamically?
I have a report that can have hundreds of items on its bar chart. I made the chart horizontal so they would presumably all show. Crystal displays it in the amount of space I have given it and only displays the text for as many items at it thinkks it can fit comfortably
So I get a chart that looks like
Item 1 |----
|----
Item 13 |---
|---
Item 37 |---
I would like to have a chart that would display the text of all of the items and grow down the page so if I happen to have 128 items the chart will be a lot longer than it will be if I have 30 items.
Is this possible?
Thanks,
Dickhi Dick,
Right Click the Chart,
Format Chart -> Can Grow (Option is Grayed out/Disabled)
From the above, Chart can't grow dynamically based on data in CR.
If you want all labels to appear,
Chart Expert -> Axes ->Number of Divisions -> manual :1
But when data is more, these labels appear very smaller.
Also, you can fix the size of chart based on estimated data before hand.
Regards,
Vamsee -
Hello. I am in the process of developing a site that will be
expanded frequently in the future. I would like to have the
navigation bar of every page update when I add new pages. How is
this best done? I am not planning on using a database here so I
want to use straight html.
Thanks, and I hope I made my question clear enough.A server-side include is another page that is inserted into
your web page.
That way when you make a change to the server-side include,
you would only need to change it, and upload it, and not every page
that
it is included on.
http://en.wikipedia.org/wiki/Server_Side_Includes
Be sure to read the external links for the scripting language
your web host supports.
http://en.wikipedia.org/wiki/Server_Side_Includes#External_links
Ken Ford
Adobe Community Expert
Fordwebs, LLC
http://www.fordwebs.com
"EdwardDarrington" <[email protected]> wrote
in message news:etkrhp$hmn$[email protected]..
> Thanks a lot for the quick answer.
>
> Would you mind expanding on that? -
I made up a status bar, but couldn't get it to be updated while some other task is being executed, like several printing jobs. The bar is a simple JPanel with a JLabel. I tried to revalidate the panel and another thread.
What do I have to do to get the message updated?but couldn't get it to be updated while some other task is being executed, like several printing jobs.Its probably because you aren't using Threads. If your printing jobs are executing in the Event Thread then the GUI can't be updated until the printing is finished. The printing code should be moved to a separate Thread.
-
I have been researching and researching and I do not know if I am going about it the wrong way or what, but I cant seem to find anyway to do a role based userbar,
so lets say I have a user who's role is a 7 in the ldap, I want to have it so he has a certain set of menu's show that is completely different than a user whos role is 2 or 3 and so forth
Is there a way to issue a line that states what a can and cannot see?
I was going through and going to make seperate static bars for each user account but I thought I'd see if this was even possible before I got too far into a flash build that could be easily distributed by creating one document and setting a user role.
Any help on this would greatly be appreciated
-EricYou can create menuitems loading XML from external files based on the role. Search for XML based dataproviders for menubar. I'll bet there's an example at Peter DeHaan's site.
-
Dynamic tool bar buttons?
I'm using RHX5 HTML. We are trying to add a button
dynamically to the toolbar, depending on the contents of a
querystring. We've decided to always add the button and then we'll
hide it depending on the querystring. Is the whtbar.js file that is
generated when you publish the webhelp version always the same
file? I assume it is and we could make some adjustments to that
file and just slide it in replacing the one that's generated. Does
anyone know if the file is adjusted on each publish or if it's just
the same file every time?
What I'm thinking here is that I make a modification to that
file, specifically to the writeToolbar function in it, and after
you recompile the help every time, you just slide in the new
version. Simple as pie.
Any ideas?So long as you make no changes in the toolbar in between, you
can do as you suggest for this project only.
If you have another project with a slightly different
toolbar, you need to make a different substitute file.
For example, if you're putting the Search form in the toolbar
and change the width of the text entry box, the output file will be
different.
My preference is to alter the newest output file after
publishing. If you're not publshing, but copying the !SSL! package
directly, you would change the output whtbar.js file in that
directory.
If you can't edit files after publishing, you can publish to
another location on your hard drive, make your changes and send the
new package to its destination. If you have a convenient way to
compare the new output package with the old one,
you would send only the changed files.
Here's another chance for me to plug Beyond Compare, a very
useful tool in which I have absolutely no financial interest or
organizational connection, other than as a user.
It's easy to find on the Web.
Harvey -
Dynamic menu bar at bottom of screen
I use DataVault for encrypted information. The version on Z10 keeps losing the memu bar at the bottom on the screen. I've Ascendo and they say it is a BlackBerry 10 issue and they are adding their own navigation buttons on their next update. Are other software developers having similar problems with the appearing and disappearing menu navigation bar?
Also, I get a message that system.apps crashes from time to time
Maybe you are looking for
-
Empty list in Purchase Order Release
I have the components and notes applied as suggested for the Approve Purchase Order Application.and configurations are done as required in the document.App Implementation: Approve Purchase Contracts - SAP Fiori principal apps for SAP ERP 1.0 - SAP Li
-
Oracle SQL Data Modeler -COMPARE/MERGE
Hi all, I am trying to compare/merge or just trying to merge a relation model with another in Oracle SQL Developer DATA MODELER. Scenario: I have tried to import from data dictionary the hr schema into 3 parts. Table employee is alone imported in one
-
Hi I need to make charge based on 100s or any part thereof. So for 223 I need to charge three times (100 + 100 + 23) etc. How do I calculate this figure of three from 223? I know there is mod but it gives me 223 mod 100 = 23 but not how many hundreds
-
Converting varchar field to date
I got a varchar field in DB with format YYYY/MM/DD HH:MI:SS in DB . I want to convert this to date field in RPD. When I did CAST ( VarChar field AS DATE) in RPD it is not working I am getting sql error. Thanks for your help.
-
I installed APEX on 11g XE but I cannot find the dads.conf file or the images directory. APEX will no longer start. I get an application not found error. What actions do I need to take to complete the install? TIA, Keith