1 /************************************************************** 2 * 3 * Licensed to the Apache Software Foundation (ASF) under one 4 * or more contributor license agreements. See the NOTICE file 5 * distributed with this work for additional information 6 * regarding copyright ownership. The ASF licenses this file 7 * to you under the Apache License, Version 2.0 (the 8 * "License"); you may not use this file except in compliance 9 * with the License. You may obtain a copy of the License at 10 * 11 * http://www.apache.org/licenses/LICENSE-2.0 12 * 13 * Unless required by applicable law or agreed to in writing, 14 * software distributed under the License is distributed on an 15 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 16 * KIND, either express or implied. See the License for the 17 * specific language governing permissions and limitations 18 * under the License. 19 * 20 *************************************************************/ 21 22 package transex3.view; 23 import javax.swing.*; 24 import java.awt.*; 25 26 public class Editor extends JFrame{ 27 Object[] columnnames = { "File" , "GID" , "LID" , "String" }; 28 Object[] stringcolnames = { "Language", "Text", "Helptext" , "Quickhelptext","Title"}; 29 //Object[][] data = new Object[4][1];//{ { "a " }, { "v " }, { "v " } , { "a " } }; 30 JTable table = null; 31 JTable rectable = null; 32 JComboBox cBox = null; 33 JMenuBar menubar = null; 34 JMenu filemenu = null; 35 JMenuItem miNew = null; 36 JMenuItem miSave = null; 37 JMenuItem miExit = null; 38 //JButton button = null; 39 Editor( Object[][] tabledata , Object[][] firstdata )40 public Editor( Object[][] tabledata , Object[][] firstdata ){ 41 table = new JTable( tabledata , columnnames ); 42 rectable = new SdfTable( firstdata , stringcolnames ); 43 menubar = new JMenuBar(); 44 filemenu = new JMenu("File"); 45 //miNew = new JMenuItem("New"); 46 miSave = new JMenuItem("Save"); 47 miExit = new JMenuItem("Exit"); 48 //button = new JButton("Edit"); 49 //filemenu.add( miNew ); 50 filemenu.add( miSave ); 51 filemenu.add( miExit ); 52 menubar.add( filemenu ); 53 54 Container contentPane = getContentPane(); 55 //contentPane.add( new ControlPanel() , BorderLayout.NORTH ); 56 contentPane.add( menubar , BorderLayout.NORTH ); 57 //JPanel aPanel = new JPanel( new FlowLayout( FlowLayout.CENTER) ); 58 JPanel aPanel = new JPanel( new GridLayout( 2,1 ) ); 59 aPanel.add( new JScrollPane( table ) ); 60 aPanel.add( new JScrollPane( rectable ) ); 61 contentPane.add( aPanel , BorderLayout.CENTER ); 62 //contentPane.add( button , BorderLayout.SOUTH ); 63 //contentPane.add( new JScrollPane( table ), BorderLayout.CENTER ); 64 //contentPane.add( new JScrollPane( table ), BorderLayout.SOUTH ); 65 //contentPane.add( new JScrollPane( rectable ), BorderLayout.SOUTH ); 66 //contentPane.add( new JScrollPane( rectable ), BorderLayout.SOUTH ); 67 this.repaint(); 68 69 } 70 getRectable()71 public JTable getRectable() { 72 return rectable; 73 } 74 setRectable(JTable rectable)75 public void setRectable(JTable rectable) { 76 this.rectable = rectable; 77 } 78 getTable()79 public JTable getTable() { 80 return table; 81 } 82 setTable(JTable table)83 public void setTable(JTable table) { 84 this.table = table; 85 } 86 87 /*public JButton getButton() { 88 return button; 89 } 90 91 public void setButton(JButton button) { 92 this.button = button; 93 }*/ 94 getMiExit()95 public JMenuItem getMiExit() { 96 return miExit; 97 } 98 setMiExit(JMenuItem miExit)99 public void setMiExit(JMenuItem miExit) { 100 this.miExit = miExit; 101 } 102 getMiSave()103 public JMenuItem getMiSave() { 104 return miSave; 105 } 106 setMiSave(JMenuItem miSave)107 public void setMiSave(JMenuItem miSave) { 108 this.miSave = miSave; 109 } 110 111 /*public void setTableData(){ 112 113 }*/ 114 115 } 116 117 //class ControlPanel extends JPanel{} 118 119