AdminMain() { l = new JLabel(); l.setBounds(10, 20, 1340, 1000); l.setBackground(Color.black); Font ft = new Font("Arial", Font.BOLD, 30); Font ft1 = new Font("Arial", Font.BOLD, 14); Font ft2 = new Font("Arial", Font.BOLD, 20); f1 = new Frame("Soft Test Management (Beta)"); f1.setLayout(null); l1 = new Label("Test Instructions", l1.CENTER); l1.setBounds(10, 20, 1300, 60); l1.setForeground(Color.blue); l1.setBackground(Color.white); l1.setFont(ft); l2 = new JLabel("Deletion of Faculty/Students"); l2.setBounds(20, 30, 1000, 500); l2.setBackground(Color.blue); l2.setFont(ft2); l3 = new JLabel("Test Pattern"); l3.setBounds(20, 90, 1300, 500); l3.setBackground(Color.green); l3.setFont(ft2); b1 = new JButton("Go !"); b1.setBounds(300, 220, 120, 30); b1.setBackground(Color.white); b1.setForeground(Color.blue); b1.setFont(ft2); b2 = new JButton("Go"); b2.setBounds(300, 240, 120, 30); b2.setBackground(Color.white); b2.setForeground(Color.blue); b2.setFont(ft2); f1.add(l); l.add(l1); l2.add(b1); l.add(l2); l3.add(b2); l.add(l3); b1.addActionListener(this); b2.addActionListener(this); f1.setVisible(true); f1.setSize(1800, 800); }
public CFFreeSwitchSwingAuditActionAttrJPanel( ICFFreeSwitchSwingSchema argSchema, ICFSecurityAuditActionObj argFocus) { super(); JLabel label; JComponent compo; CFJReferenceEditor reference; final String S_ProcName = "construct-schema-focus"; if (argSchema == null) { throw CFLib.getDefaultExceptionFactory() .newNullArgumentException(getClass(), S_ProcName, 1, "argSchema"); } // argFocus is optional; focus may be set later during execution as // conditions of the runtime change. swingSchema = argSchema; setSwingFocusAsAuditAction(argFocus); final int spacing = 5; int y = spacing; final int height = 25; final int textheight = 80; final int vspacing = height + spacing; final int textvspacing = textheight + spacing; final int labelx = spacing; final int labelwidth = 200; final int fieldx = labelx + labelwidth + spacing; final int fieldwidth = 785; final int panelwidth = fieldx + fieldwidth + spacing; // temporary -- I think you have to have a panel bigger than the coordinates initially setSize(panelwidth, 100000); label = getSwingLabelAuditActionId(); add(label); label.setBounds(labelx, y, labelwidth, height); compo = getSwingEditorAuditActionId(); add(compo); compo.setBounds(fieldx, y, fieldwidth, height); y = y + vspacing; label = getSwingLabelDescription(); add(label); label.setBounds(labelx, y, labelwidth, height); compo = getSwingEditorDescription(); add(compo); compo.setBounds(fieldx, y, fieldwidth, height); y = y + vspacing; // Now we can set the proper size based on the fields and references populated setSize(panelwidth, y); Dimension pfsz = new Dimension(panelwidth, y); setPreferredSize(pfsz); Dimension min = new Dimension(400, y); setMinimumSize(min); populateFields(); adjustComponentEnableStates(); swingIsInitializing = false; }
private void initUI() { this.setLayout(new BorderLayout()); JPanel infoPanel = new JPanel(); infoPanel.setLayout(new FlowLayout(FlowLayout.LEFT)); infoPanel.setBackground(Color.WHITE); infoPanel.setBorder(BorderFactory.createLineBorder(Color.BLACK)); infoPanel.add( new JLabel( new ImageIcon( Thread.currentThread().getContextClassLoader().getResource("siw-logo3_2.gif")))); JLabel infoLabel = new JLabel("<html>Please select a project and context<br> Version must be a number</html>"); infoPanel.add(infoLabel); this.add(infoPanel, BorderLayout.NORTH); JPanel entryPanel = new JPanel(); entryPanel.setLayout(null); projectNameField.setText(""); JLabel projectNameLabel = new JLabel("Project Name"); projectNameLabel.setBounds(new Rectangle(30, 80, 135, 20)); projectNameField.setBounds(new Rectangle(180, 80, 175, 20)); JLabel projectVersionLabel = new JLabel("Project Version"); projectVersionLabel.setBounds(new Rectangle(30, 125, 135, 20)); projectVersionField.setBounds(new Rectangle(180, 125, 175, 20)); JLabel contextLabel = new JLabel("Context"); contextLabel.setBounds(new Rectangle(30, 165, 135, 20)); contextComboBox.setBounds(new Rectangle(180, 165, 175, 20)); JLabel packageLabel = new JLabel("Select Package"); packageLabel.setBounds(new Rectangle(30, 210, 135, 20)); packageComboBox.setBounds(new Rectangle(180, 210, 250, 20)); entryPanel.add(projectNameLabel, null); entryPanel.add(projectNameField, null); entryPanel.add(projectVersionLabel, null); entryPanel.add(projectVersionField, null); entryPanel.add(contextLabel, null); entryPanel.add(contextComboBox, null); entryPanel.add(packageLabel, null); entryPanel.add(packageComboBox, null); this.add(entryPanel, BorderLayout.CENTER); projectVersionField.addKeyListener(this); projectNameField.addKeyListener(this); }
public void doLayout() { JLabel label; JComponent compo; CFJReferenceEditor reference; Dimension dim; final int spacing = 5; int y = spacing; final int height = 25; final int textheight = 80; final int vspacing = height + spacing; final int textvspacing = textheight + spacing; final int labelx = spacing; final int labelwidth = 200; final int fieldx = labelx + labelwidth + spacing; final int fieldwidth = 1024; Dimension jpsz = getSize(); int usefieldwidth = jpsz.width - 215; label = getSwingLabelId(); label.setBounds(labelx, y, labelwidth, height); compo = getSwingEditorId(); dim = compo.getMaximumSize(); if (dim.width < usefieldwidth) { compo.setBounds(fieldx, y, dim.width, height); } else { compo.setBounds(fieldx, y, fieldwidth, height); } y = y + vspacing; label = getSwingLabelFullDomainName(); label.setBounds(labelx, y, labelwidth, height); compo = getSwingEditorFullDomainName(); dim = compo.getMaximumSize(); if (dim.width < usefieldwidth) { compo.setBounds(fieldx, y, dim.width, height); } else { compo.setBounds(fieldx, y, fieldwidth, height); } y = y + vspacing; label = getSwingLabelDescription(); label.setBounds(labelx, y, labelwidth, height); compo = getSwingEditorDescription(); dim = compo.getMaximumSize(); if (dim.width < usefieldwidth) { compo.setBounds(fieldx, y, dim.width, height); } else { compo.setBounds(fieldx, y, fieldwidth, height); } y = y + vspacing; }
/** Create the frame */ public DateTimer() { super(); setTitle("v14 CountDown"); getContentPane().setLayout(null); setBounds(100, 100, 500, 375); setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); final JLabel finishtimeLabel = new JLabel(); finishtimeLabel.setText("CountDown Time"); finishtimeLabel.setBounds(10, 36, 119, 15); getContentPane().add(finishtimeLabel); finishtime = new JFormattedTextField( new DateFormatter(new SimpleDateFormat("MM/dd/yyyy hh:mm:ss aa", Locale.ENGLISH))); finishtime.addActionListener( new ActionListener() { public void actionPerformed(final ActionEvent e) {} }); finishtime.setValue(new Date()); finishtime.setBounds(135, 34, 187, 19); getContentPane().add(finishtime); final JButton startButton = new JButton(); startButton.addActionListener( new ActionListener() { public void actionPerformed(final ActionEvent e) { startCount(); } }); startButton.setText("Start!!!"); startButton.setBounds(334, 31, 111, 25); getContentPane().add(startButton); countLabel = new JLabel(); countLabel.setHorizontalAlignment(SwingConstants.CENTER); countLabel.setHorizontalTextPosition(SwingConstants.CENTER); countLabel.setFont(new Font("Lucida Grande", Font.PLAIN, 14)); countLabel.setBorder(new LineBorder(Color.black, 1, false)); countLabel.setText("Countdown not Started"); countLabel.setBounds(10, 162, 435, 47); getContentPane().add(countLabel); final JLabel credits = new JLabel(); credits.setHorizontalAlignment(SwingConstants.RIGHT); credits.setText(""); credits.setBounds(253, 328, 237, 15); getContentPane().add(credits); }
public void tampilan_GUI() { this.getContentPane().setBackground(Color.yellow); this.getContentPane().setLayout(null); jLabel1.setFont(new java.awt.Font("Dialog", 1, 16)); jLabel1.setText("Please Waiting..."); jLabel1.setBounds(new Rectangle(14, 5, 187, 30)); prosesBar.setBounds(new Rectangle(14, 40, 311, 16)); prosesBar.setStringPainted(true); statusProses.setText(""); statusProses.setBounds(new Rectangle(14, 60, 311, 16)); this.getContentPane().add(jLabel1); this.getContentPane().add(prosesBar); this.getContentPane().add(statusProses); }
public PlayerPanel(ActionListener listener) { Dimension size; Insets in = this.getInsets(); this.numberOfPlayersButtons = new ArrayList<JButton>(this.possiblePlayersAmount); this.colorButtons = new LinkedList<JButton>(); label = new JLabel("Escolha a quantidade de jogadores:"); this.add(label); size = label.getPreferredSize(); label.setBounds(90, 5 + in.top, size.width, size.height); for (int i = 0; i < this.possiblePlayersAmount; i++) { JButton tempButton = new JButton(String.format("%d", i + 3)); numberOfPlayersButtons.add(tempButton); size = tempButton.getPreferredSize(); tempButton.setBounds(45 + 75 * i + in.left, 80 + in.top, size.width, size.height); tempButton.addActionListener(listener); this.add(tempButton); } this.setSize(this.getPreferredSize()); this.setLayout(null); this.listener = listener; }
public void doLayout() { JLabel label; JComponent compo; CFJReferenceEditor reference; Dimension dim; final int spacing = 5; int y = spacing; final int height = 25; final int textheight = 80; final int vspacing = height + spacing; final int textvspacing = textheight + spacing; final int labelx = spacing; final int labelwidth = 200; final int fieldx = labelx + labelwidth + spacing; final int fieldwidth = 1024; Dimension jpsz = getSize(); int usefieldwidth = jpsz.width - 215; label = getSwingLabelContainerTenant(); label.setBounds(labelx, y, labelwidth, height); reference = getSwingReferenceContainerTenant(); reference.setBounds(fieldx, y, usefieldwidth, height); y = y + vspacing; label = getSwingLabelTSecGroupId(); label.setBounds(labelx, y, labelwidth, height); compo = getSwingEditorTSecGroupId(); dim = compo.getMaximumSize(); if (dim.width < usefieldwidth) { compo.setBounds(fieldx, y, dim.width, height); } else { compo.setBounds(fieldx, y, fieldwidth, height); } y = y + vspacing; label = getSwingLabelName(); label.setBounds(labelx, y, labelwidth, height); compo = getSwingEditorName(); dim = compo.getMaximumSize(); if (dim.width < usefieldwidth) { compo.setBounds(fieldx, y, dim.width, height); } else { compo.setBounds(fieldx, y, fieldwidth, height); } y = y + vspacing; }
// Initializes this component private void jbInit() { partNameLbl.setFont(Utilities.bigLabelsFont); partNameLbl.setHorizontalAlignment(SwingConstants.CENTER); partNameLbl.setText("keyboard"); partNameLbl.setForeground(Color.black); partNameLbl.setBounds(new Rectangle(62, 10, 102, 21)); this.add(partNameLbl, null); }
public ShowComp() throws InterruptedException, IOException { super("CONNECTED COMPUTERS"); int x = 0, d = 20; mb = new JMenuBar(); File = new JMenu("File"); mb.add(File); exit = new JMenuItem("Exit"); exit.addActionListener(this); File.add(exit); ta = new JTextArea(); ta.setBounds(20, 30, 315, 470); ta.setEditable(false); add(ta); setJMenuBar(mb); sel = new JLabel("The connected computers are.."); sel.setBounds(15, 5, 300, 30); add(sel); b1 = new JButton("<< BACK"); b1.setBounds(140, 510, 100, 30); b1.setToolTipText("Back to main page"); b1.addActionListener(this); add(b1); setLayout(null); while (x < 360) { x = x + d; setBounds(675, 50, x, 600); this.show(); } // setVisible(true); String s = "192.168.0.", temp = null; Printer printer = new Printer(); printer.start(); Connector connector = new Connector(printer); connector.start(); LinkedList targets = new LinkedList(); for (int i = 1; i <= 255; i++) { temp = s + Integer.toString(i); Target t = new Target(temp); targets.add(t); connector.add(t); } Thread.sleep(2000); connector.shutdown(); connector.join(); for (Iterator i = targets.iterator(); i.hasNext(); ) { Target t = (Target) i.next(); if (!t.shown) t.show(); } setDefaultCloseOperation(DISPOSE_ON_CLOSE); }
public static void refreshCalendar(int month, int year) { // instantiation String[] months = { "January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December" }; int numoday, startom; // Number Of Days, Start Of Month // Allow/disallow buttons prev.setEnabled(true); next.setEnabled(true); if (month == 0 && year <= ryear) { prev.setEnabled(false); } // Cannot set an appointment back in time if (month == 11 && year >= ryear + 50) { next.setEnabled(false); } // Too early to set an appointment lmonth.setText(months[month]); // Refresh the month label (at the top) lmonth.setBounds( 160 - lmonth.getPreferredSize().width / 2, 25, 180, 25); // Re-align label with calendar cyear.setSelectedItem(String.valueOf(year)); // Select the correct year in the combo box // deletes current table for (int i = 0; i < 6; i++) { for (int j = 0; j < 7; j++) { mcal.setValueAt(null, i, j); } } // Get first day of month and number of days GregorianCalendar cal = new GregorianCalendar(year, month, 1); numoday = cal.getActualMaximum(GregorianCalendar.DAY_OF_MONTH); startom = cal.get(GregorianCalendar.DAY_OF_WEEK); // Create calendar for (int i = 1; i <= numoday; i++) { int row = new Integer((i + startom - 2) / 7); int column = (i + startom - 2) % 7; mcal.setValueAt(i, row, column); } // Apply renderers Cal.setDefaultRenderer(Cal.getColumnClass(0), new tblCalendarRenderer()); }
// Unique methods public void checkBottomCard() { if (m.getNextEmptyCard() == null) { SylladexCard bottomcard = stack.getLast(); icons.trimToSize(); JLabel icon = new JLabel(bottomcard.getIcon().getIcon()); int xpos = m.getScreenSize().width / 2 + (25 * m.getCards().size()); arrow = new JLabel(Main.createImageIcon("modi/stack/arrow.gif")); arrow.setBounds(xpos, m.getDockIconYPosition(), 43, 60); icon.setBounds(xpos + 50, m.getDockIconYPosition(), 43, 60); m.showDock(); foreground.add(arrow); foreground.add(icon); foreground.repaint(); timer.restart(); open(bottomcard); } }
// Initializing this component. private void jbInit() { callStackTable.addFocusListener( new FocusListener() { public void focusGained(FocusEvent e) { callStackTable_focusGained(e); } public void focusLost(FocusEvent e) { callStackTable_focusLost(e); } }); callStackTable.setTableHeader(null); callStackTable.setDefaultRenderer(callStackTable.getColumnClass(0), getCellRenderer()); scrollPane = new JScrollPane(callStackTable); setVisibleRows(DEFAULT_VISIBLE_ROWS); scrollPane.setLocation(0, 27); setBorder(BorderFactory.createEtchedBorder()); // this.setLayout(null); this.setLayout(new GridBagLayout()); nameLbl.setText("Call Stack"); nameLbl.setBounds(new Rectangle(3, 4, 70, 23)); nameLbl.setFont(Utilities.labelsFont); GridBagConstraints c = new GridBagConstraints(); c.fill = GridBagConstraints.BOTH; c.ipadx = 0; c.ipady = 0; c.weightx = 1; c.weighty = 1; c.gridwidth = 7; c.gridheight = 1; c.anchor = GridBagConstraints.PAGE_END; c.gridx = 0; c.gridy = 2; this.add(scrollPane, c); c.fill = GridBagConstraints.HORIZONTAL; c.ipadx = 0; c.ipady = 0; c.weightx = 1; c.weighty = 0.0; c.gridwidth = 3; c.gridheight = 1; c.anchor = GridBagConstraints.FIRST_LINE_START; c.gridx = 0; c.gridy = 0; c.insets = new Insets(5, 0, 0, 0); this.add(nameLbl, c); }
private void addLabelOnPanel(int i, String str, boolean listenerSign) { final JLabel label = new JLabel(str); label.setBackground(Color.WHITE); label.setBounds(startPoint_x, startPoint_y, 20, 20); startPoint_x += 40; if (i == 6) { startPoint_x = 20; startPoint_y += 35; } panel.add(label); if (listenerSign) { //// ???????????????????????????? if (getNum(7 - i) == 1) { int selected = Integer.parseInt(str); if (cal.get(Calendar.DAY_OF_MONTH) == selected) { lastLabel = label; lastLabel.setForeground(Color.RED); } label.addMouseListener( new MouseAdapter() { @Override public void mouseClicked(MouseEvent e) { lastLabel.setForeground(Color.BLACK); label.setForeground(Color.RED); lastLabel = label; } }); } else { int selected = Integer.parseInt(str); if (cal.get(Calendar.DAY_OF_MONTH) == selected) { lastLabel = label; lastLabel.setForeground(Color.BLUE); } label.addMouseListener( new MouseAdapter() { @Override public void mouseClicked(MouseEvent e) { lastLabel.setForeground(Color.BLACK); label.setForeground(Color.BLUE); lastLabel = label; } }); } } }
public void showColorButtons() { Color colors[] = {Color.RED, Color.BLACK, Color.WHITE, Color.GREEN, Color.YELLOW, Color.BLUE}; Insets in = this.getInsets(); this.input = new JTextField(); this.add(this.input); this.input.setBounds(100 + in.left, 36 + in.top, 200, 30); int arrayAmount = numberOfPlayersButtons.size(); for (int i = 0; i < numberOfPlayersButtons.size(); i++) { this.remove(numberOfPlayersButtons.get(i)); } numberOfPlayersButtons = null; arrayAmount = this.maxPlayersAmount; for (int i = 0; i < arrayAmount; i++) { JButton tempButton = new JButton(); colorButtons.add(tempButton); tempButton.setBackground(colors[i]); tempButton.setBorderPainted(false); tempButton.setOpaque(true); tempButton.setBounds(65 + i * 45 + in.left, 81 + in.top, 25, 25); tempButton.addActionListener(this.listener); this.add(tempButton); } Dimension size; size = label.getPreferredSize(); label.setBounds(65, 5 + in.top, size.width + 48, size.height); label.setText("Jogador 1, informe a sua cor e o seu nome:"); this.repaint(); }
static void GoEnd(JFrame frame, int i) { Image background = new ImageIcon("image/final_" + i + ".png").getImage(); background = background.getScaledInstance(frame.getWidth(), frame.getHeight(), Image.SCALE_DEFAULT); JLabel back = new JLabel(); back.setBounds(0, 0, frame.getWidth(), frame.getHeight()); back.setIcon(new ImageIcon(background)); frame.add(back, 1); frame.validate(); frame.repaint(); if (i == 1) { // 烤好 Talk.say("你成功的通過了這學期", 1); Talk.say("這次經驗也讓你對學習產生濃烈的興趣", 1); Talk.say("讓你大四成為了神,進而順利畢業", 1); } else if (i == 2) { // 系館 Talk.say("經由你的捐贈", 1); Talk.say("資訊系逐漸自成一個校區", 1); Talk.say("而在原系館中庭擺放了一個十倍放大的銅像", 1); Talk.say("用來紀念資訊系傑出校友─大恩碩像", 1); } else if (i == 3) { // 出國 Talk.say("你放棄了學業,踏上了桌球國手之路", 1); Talk.say("過五關斬六將", 1); Talk.say("終於成為了世界桌球王", 1); } else if (i == 4) { // 0分 game over Talk.say("輕輕的我走了", 1); Talk.say("正如我輕輕地來", 1); Talk.say("我揮一揮衣袖", 1); Talk.say("不帶走任何學分", 1); } else if (i == 5) { // final Talk.say("你完成了final project", 1); Talk.say("跟其他同學一起過了OOP", 1); Talk.say("不過大四還有更嚴苛的挑戰在等著你", 1); Talk.say("同學!加油吧!", 1); } }
public void gold() throws Exception { frm = new JFrame(); frm.setTitle("Background Color for JFrame"); // frm.setSize(400, 400); frm.setLocationRelativeTo(null); // frm.setDefaultCloseOperation(EXIT_ON_CLOSE); frm.setVisible(true); frm.setLayout(new BorderLayout()); JLabel background = new JLabel(new ImageIcon("C:\\Users\\appy\\Desktop\\programs\\i_O\\Untitled.jpg")); frm.add(background); // background.setLayout(new FlowLayout()); background.setLayout(null); lh2 = (int) (((((Math.random()) * 5) * 5) * 5) * 7); lh3 = (int) (((((Math.random()) * 5) * 5) * 5) * 7); lh4 = (int) (((((Math.random()) * 5) * 5) * 5) * 5); lh5 = (int) (((((Math.random()) * 5) * 5) * 5) * 5); lh6 = (int) (((((Math.random()) * 5) * 5) * 5) * 5); lh7 = (int) (((((Math.random()) * 5) * 5) * 5) * 5); lh8 = (int) (((((Math.random()) * 5) * 5) * 5) * 5); lh9 = (int) (((((Math.random()) * 5) * 5) * 5) * 5); lh0 = (int) (((((Math.random()) * 5) * 5) * 5) * 5); // JLabel l1=new JLabel(new ImageIcon("C:\\Users\\appy\\Desktop\\programs\\i_O\\images.gif")); JLabel l1 = new JLabel(new ImageIcon("C:\\Users\\appy\\Desktop\\programs\\i_O\\images.gif")); JLabel l2 = new JLabel(new ImageIcon("C:\\Users\\appy\\Desktop\\programs\\i_O\\car_top_view.gif")); JLabel l3 = new JLabel(new ImageIcon("C:\\Users\\appy\\Desktop\\programs\\i_O\\car_top_view.gif")); JLabel l4 = new JLabel(new ImageIcon("C:\\Users\\appy\\Desktop\\programs\\i_O\\car_top_view.gif")); JLabel l5 = new JLabel(new ImageIcon("C:\\Users\\appy\\Desktop\\programs\\i_O\\car_top_view.gif")); JLabel l6 = new JLabel(new ImageIcon("C:\\Users\\appy\\Desktop\\programs\\i_O\\car_top_view.gif")); JLabel l7 = new JLabel(new ImageIcon("C:\\Users\\appy\\Desktop\\programs\\i_O\\car_top_view.gif")); JLabel l8 = new JLabel(new ImageIcon("C:\\Users\\appy\\Desktop\\programs\\i_O\\car_top_view.gif")); JLabel l9 = new JLabel(new ImageIcon("C:\\Users\\appy\\Desktop\\programs\\i_O\\car_top_view.gif")); JLabel l0 = new JLabel(new ImageIcon("C:\\Users\\appy\\Desktop\\programs\\i_O\\car_top_view.gif")); txter = new JTextField(100); txter.setBounds(3, 4, 0, 35); txter.addKeyListener(this); txter.getCursor(); txter.setText(strgr); row += 10; for (int it = 1; it > 0; it += 7) { // Rectangle r=compu l1.setBounds(300 + my_car.row, 400 + my_car.col, 90, 190); l2.setBounds(lh2, -250 + chg, 90, 190); l3.setBounds(lh3, -750 + chg, 90, 190); l4.setBounds(lh4, -1200 + chg, 90, 190); l5.setBounds(lh5, -1750 + chg, 90, 190); l6.setBounds(lh6, -2250 + chg, 90, 190); l7.setBounds(lh7, -2700 + chg, 90, 190); l8.setBounds(lh8, -3250 + chg, 90, 190); l9.setBounds(lh9, -3800 + chg, 90, 190); l0.setBounds(lh0, -4250 + chg, 90, 190); chg += 20; if (chg >= (5000)) { chg = 0; lh2 = (int) (((((Math.random()) * 5) * 5) * 5) * 5); Thread.sleep(7); lh3 = (int) (((((Math.random()) * 5) * 5) * 5) * 5); Thread.sleep(7); lh4 = (int) (((((Math.random()) * 5) * 5) * 5) * 5); Thread.sleep(7); lh5 = (int) (((((Math.random()) * 5) * 5) * 5) * 5); Thread.sleep(7); lh6 = (int) (((((Math.random()) * 5) * 5) * 5) * 5); Thread.sleep(7); lh7 = (int) (((((Math.random()) * 5) * 5) * 5) * 5); Thread.sleep(7); lh8 = (int) (((((Math.random()) * 5) * 5) * 5) * 5); Thread.sleep(7); lh9 = (int) (((((Math.random()) * 5) * 5) * 5) * 5); Thread.sleep(7); lh0 = (int) (((((Math.random()) * 5) * 5) * 5) * 5); } txter.requestDefaultFocus(); { } Thread.sleep(50); System.out.println(my_car.row); l1.repaint(); l2.repaint(); // b1=new JButton("I am a button"); background.add(l1); background.add(l2); background.add(l3); background.add(l4); background.add(l5); background.add(l6); background.add(l7); background.add(l8); background.add(l9); background.add(l0); background.add(txter); // background.add(b1); // frm.setSize(799, 699); frm.setBounds(0, 0, 800, 700); frm.setResizable(false); } }
public PanelMore(OSeaMAction dia) { dlg = dia; setLayout(null); panelPat = new PanelPat(dlg, Ent.BODY); panelPat.setBounds(new Rectangle(0, 0, 110, 160)); add(panelPat); add(getRegionButton(regionAButton, 110, 0, 34, 30, "RegionA")); add(getRegionButton(regionBButton, 110, 32, 34, 30, "RegionB")); add(getRegionButton(regionCButton, 110, 64, 34, 30, "RegionC")); elevLabel = new JLabel(Messages.getString("Elevation"), SwingConstants.CENTER); elevLabel.setBounds(new Rectangle(140, 0, 90, 20)); add(elevLabel); elevBox = new JTextField(); elevBox.setBounds(new Rectangle(160, 20, 50, 20)); elevBox.setHorizontalAlignment(SwingConstants.CENTER); add(elevBox); elevBox.addFocusListener(flElev); heightLabel = new JLabel(Messages.getString("Height"), SwingConstants.CENTER); heightLabel.setBounds(new Rectangle(140, 40, 90, 20)); add(heightLabel); heightBox = new JTextField(); heightBox.setBounds(new Rectangle(160, 60, 50, 20)); heightBox.setHorizontalAlignment(SwingConstants.CENTER); add(heightBox); heightBox.addFocusListener(flHeight); sourceLabel = new JLabel(Messages.getString("Source"), SwingConstants.CENTER); sourceLabel.setBounds(new Rectangle(110, 80, 130, 20)); add(sourceLabel); sourceBox = new JTextField(); sourceBox.setBounds(new Rectangle(110, 100, 130, 20)); sourceBox.setHorizontalAlignment(SwingConstants.CENTER); add(sourceBox); sourceBox.addFocusListener(flSource); infoLabel = new JLabel(Messages.getString("Information"), SwingConstants.CENTER); infoLabel.setBounds(new Rectangle(110, 120, 130, 20)); add(infoLabel); infoBox = new JTextField(); infoBox.setBounds(new Rectangle(110, 140, 130, 20)); infoBox.setHorizontalAlignment(SwingConstants.CENTER); add(infoBox); infoBox.addFocusListener(flInfo); statusLabel = new JLabel(Messages.getString("Status"), SwingConstants.CENTER); statusLabel.setBounds(new Rectangle(250, 0, 100, 20)); add(statusLabel); statusBox = new JComboBox(); statusBox.setBounds(new Rectangle(250, 20, 100, 20)); addStsItem("", Sts.UNKSTS); addStsItem(Messages.getString("Permanent"), Sts.PERM); addStsItem(Messages.getString("Occasional"), Sts.OCC); addStsItem(Messages.getString("Recommended"), Sts.REC); addStsItem(Messages.getString("NotInUse"), Sts.NIU); addStsItem(Messages.getString("Intermittent"), Sts.INT); addStsItem(Messages.getString("Reserved"), Sts.RESV); addStsItem(Messages.getString("Temporary"), Sts.TEMP); addStsItem(Messages.getString("Private"), Sts.PRIV); addStsItem(Messages.getString("Mandatory"), Sts.MAND); addStsItem(Messages.getString("Destroyed"), Sts.DEST); addStsItem(Messages.getString("Extinguished"), Sts.EXT); addStsItem(Messages.getString("Illuminated"), Sts.ILLUM); addStsItem(Messages.getString("Historic"), Sts.HIST); addStsItem(Messages.getString("Public"), Sts.PUB); addStsItem(Messages.getString("Synchronized"), Sts.SYNC); addStsItem(Messages.getString("Watched"), Sts.WATCH); addStsItem(Messages.getString("UnWatched"), Sts.UNWAT); addStsItem(Messages.getString("Doubtful"), Sts.DOUBT); add(statusBox); statusBox.addActionListener(alStatus); constrLabel = new JLabel(Messages.getString("Construction"), SwingConstants.CENTER); constrLabel.setBounds(new Rectangle(250, 40, 100, 20)); add(constrLabel); constrBox = new JComboBox(); constrBox.setBounds(new Rectangle(250, 60, 100, 20)); addCnsItem("", Cns.UNKCNS); addCnsItem(Messages.getString("Masonry"), Cns.BRICK); addCnsItem(Messages.getString("Concreted"), Cns.CONC); addCnsItem(Messages.getString("Boulders"), Cns.BOULD); addCnsItem(Messages.getString("HardSurfaced"), Cns.HSURF); addCnsItem(Messages.getString("Unsurfaced"), Cns.USURF); addCnsItem(Messages.getString("Wooden"), Cns.WOOD); addCnsItem(Messages.getString("Metal"), Cns.METAL); addCnsItem(Messages.getString("GRP"), Cns.GLAS); addCnsItem(Messages.getString("Painted"), Cns.PAINT); add(constrBox); constrBox.addActionListener(alConstr); conLabel = new JLabel(Messages.getString("Conspicuity"), SwingConstants.CENTER); conLabel.setBounds(new Rectangle(250, 80, 100, 20)); add(conLabel); conBox = new JComboBox(); conBox.setBounds(new Rectangle(250, 100, 100, 20)); addConItem("", Con.UNKCON); addConItem(Messages.getString("Conspicuous"), Con.CONSP); addConItem(Messages.getString("NotConspicuous"), Con.NCONS); add(conBox); conBox.addActionListener(alCon); reflLabel = new JLabel(Messages.getString("Reflectivity"), SwingConstants.CENTER); reflLabel.setBounds(new Rectangle(250, 120, 100, 20)); add(reflLabel); reflBox = new JComboBox(); reflBox.setBounds(new Rectangle(250, 140, 100, 20)); addReflItem("", Con.UNKCON); addReflItem(Messages.getString("Conspicuous"), Con.CONSP); addReflItem(Messages.getString("NotConspicuous"), Con.NCONS); addReflItem(Messages.getString("Reflector"), Con.REFL); add(reflBox); reflBox.addActionListener(alRefl); }
private void initializeComponents() { this.setTitle("Synchro - Kopierassistent"); this.setBounds(0, 0, 550, 600); this.setResizable(true); this.setLayout(null); this.setDefaultCloseOperation(JFrame.DO_NOTHING_ON_CLOSE); this.addWindowListener(this); mainPanel = new JPanel(); mainPanel.setBounds(0, 0, this.getWidth() - 20, 25); // fcPanel.setBorder(BorderFactory.createLineBorder(Color.BLACK)); mainPanel.setLayout(null); btnBackup = new JButton("Backup"); btnBackup.setBounds(this.getWidth() / 2, 0, this.getWidth() / 2 - 20, mainPanel.getHeight()); btnBackup.addActionListener(this); mainPanel.add(btnBackup); this.add(mainPanel); fcPanel = new JPanel(); fcPanel.setBounds(10, 40, this.getWidth(), 260); // fcPanel.setBorder(BorderFactory.createLineBorder(Color.BLACK)); fcPanel.setLayout(null); quellLabel = new JLabel("Bitte Quellverzeichnis auswählen"); quellLabel.setBounds(10, 5, 320, 20); fcPanel.add(quellLabel); quellListModel = new DefaultListModel<>(); quellJList = new JList<ListItem>(quellListModel); quellJList.setSelectionMode(ListSelectionModel.SINGLE_SELECTION); quellJList.setLayoutOrientation(JList.VERTICAL); quellJList.addListSelectionListener(this); listBoxScroller = new JScrollPane(quellJList); listBoxScroller.setBounds(0, 30, 315, 100); fcPanel.add(listBoxScroller); btnQAuswahl = new JButton("Quellverz. hinzufügen"); btnQAuswahl.setBounds(320, 30, 200, 25); btnQAuswahl.addActionListener(this); fcPanel.add(btnQAuswahl); btnQEntfernen = new JButton("Quellverz. entfernen"); btnQEntfernen.setBounds(320, 60, 200, 25); btnQEntfernen.addActionListener(this); fcPanel.add(btnQEntfernen); zielLabel = new JLabel("Bitte Zielverzeichnis auswählen"); zielLabel.setBounds(10, 135, 320, 20); fcPanel.add(zielLabel); zielListModel = new DefaultListModel<>(); zielJList = new JList<ListItem>(zielListModel); zielJList.setSelectionMode(ListSelectionModel.SINGLE_SELECTION); zielJList.setLayoutOrientation(JList.VERTICAL); zielJList.addListSelectionListener(this); listBoxScroller2 = new JScrollPane(zielJList); listBoxScroller2.setBounds(0, 160, 315, 100); fcPanel.add(listBoxScroller2); btnZAuswahl = new JButton("Zielverz. hinzufügen"); btnZAuswahl.setBounds(320, 160, 200, 25); btnZAuswahl.addActionListener(this); fcPanel.add(btnZAuswahl); btnZEntfernen = new JButton("Zielverz. entfernen"); btnZEntfernen.setBounds(320, 190, 200, 25); btnZEntfernen.addActionListener(this); fcPanel.add(btnZEntfernen); this.add(fcPanel); ButtonGroup bGrp = new ButtonGroup(); optionPanel = new JPanel(); optionPanel.setBounds(10, 300 + 10, this.getWidth() - 40, 90); optionPanel.setPreferredSize(new Dimension(this.getWidth() - 40, 90)); // optionPanel.setBorder(BorderFactory.createLineBorder(Color.BLACK)); optionPanel.setLayout(new GridLayout(3, 1)); nUebSchr = new JRadioButton("Keine Dateien überschreiben"); nUebSchr.addItemListener(this); bGrp.add(nUebSchr); optionPanel.add(nUebSchr); ueSchr = new JRadioButton("Neuere Dateien überschreiben"); ueSchr.addItemListener(this); bGrp.add(ueSchr); optionPanel.add(ueSchr); aUeSchr = new JRadioButton("Alle Dateien überschreiben"); aUeSchr.addItemListener(this); bGrp.add(aUeSchr); optionPanel.add(aUeSchr); this.add(optionPanel); syncPanel = new JPanel(); syncPanel.setBounds( 10, optionPanel.getY() + optionPanel.getHeight() + 10, this.getWidth() - 30, 25); // syncPanel.setBorder(BorderFactory.createLineBorder(Color.BLACK)); syncPanel.setLayout(new BorderLayout()); btnSync = new JButton("Sync it!"); btnSync.setBounds(0, 0, 150, (syncPanel.getHeight() / 3)); btnSync.addActionListener(this); btnSync.setPreferredSize(new Dimension(150, (syncPanel.getHeight() / 3))); btnSync.setMaximumSize(new Dimension(150, (syncPanel.getHeight() / 3))); syncPanel.add(btnSync, BorderLayout.LINE_START); btnAbbruch = new JButton("Abbrechen"); btnAbbruch.setBounds(0, 0, 150, (syncPanel.getHeight() / 3)); btnAbbruch.addActionListener(this); btnAbbruch.setPreferredSize(new Dimension(150, (syncPanel.getHeight() / 3))); btnAbbruch.setMaximumSize(new Dimension(150, (syncPanel.getHeight() / 3))); btnAbbruch.setVisible(false); syncPanel.add(btnAbbruch, BorderLayout.LINE_END); progressBar = new JProgressBar(JProgressBar.HORIZONTAL); progressBar.setBorderPainted(true); progressBar.setPreferredSize(new Dimension(300, (syncPanel.getHeight() / 3))); progressBar.setForeground(Color.RED); progressBar.setStringPainted(true); progressBar.setVisible(true); syncPanel.add(progressBar, BorderLayout.CENTER); this.add(syncPanel); logPanel = new JPanel(); logPanel.setBounds( 10, syncPanel.getY() + syncPanel.getHeight() + 10, this.getWidth() - 30, 105); logPanel.setLayout(new BorderLayout()); textArea = new JTextArea(); textArea.setMargin(new Insets(3, 3, 3, 3)); textArea.setBackground(Color.black); textArea.setForeground(Color.LIGHT_GRAY); textArea.setAutoscrolls(true); textArea.setFocusable(false); textAreaScroller = new JScrollPane(textArea); DefaultCaret caret = (DefaultCaret) textArea.getCaret(); caret.setUpdatePolicy(DefaultCaret.ALWAYS_UPDATE); textAreaScroller.setBounds(0, 0, syncPanel.getWidth(), 50); logPanel.add(textAreaScroller, BorderLayout.CENTER); this.add(logPanel, BorderLayout.SOUTH); }
public Pregunta24(int s) { this.s = s; pregunta = 24; setLayout(null); setBounds(150, 5, 1080, 720); preguntinis = "24. ¿Cuál opción incluye los tres sectores sociales?"; resp24 = new String[4]; resp24[0] = "Agropecuario, Industrial y de Servicios"; resp24[1] = "Agropecuario, de Servicios y Comunicaciones"; resp24[2] = "Transporte, Comunicaciones y Sevicios"; resp24[3] = "Servicios, Comunicaciones y Cableado"; opc1 = new JButton(resp24[0]); opc1.setBounds(50, 300, 290, 30); opc1.addActionListener(this); add(opc1); opc2 = new JButton(resp24[1]); opc2.setBounds(50, 350, 290, 30); opc2.addActionListener(this); add(opc2); opc3 = new JButton(resp24[2]); opc3.setBounds(50, 400, 290, 30); opc3.addActionListener(this); add(opc3); opc4 = new JButton(resp24[3]); opc4.setBounds(50, 450, 290, 30); opc4.addActionListener(this); add(opc4); titulo = new JLabel(preguntinis, SwingConstants.CENTER); titulo.setFont(new Font("Century Ghotic", Font.BOLD, 20)); titulo.setBounds(0, 90, 1080, 50); titulo.setHorizontalTextPosition(SwingConstants.CENTER); add(titulo); puntua = new JLabel("Score: " + s); puntua.setFont(new Font("Century Ghotic", Font.BOLD, 17)); puntua.setBounds(910, 600, 1080, 50); add(puntua); salir = new JButton("Salir"); salir.setBounds(50, 610, 100, 30); salir.addActionListener(this); add(salir); setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); fondo = new JLabel(); ImageIcon icon = new ImageIcon(getClass().getResource("/imagenes/imagen.jpg")); fondo.setIcon(icon); fondo.setBounds(0, 0, 1080, 720); add(fondo); setVisible(true); }
public Pregunta13(int s) { this.s = s; pregunta = 13; setLayout(null); setBounds(150, 5, 1080, 720); preguntinis = "13. Es una caracteristica del socialismo:"; resp13 = new String[4]; resp13[0] = "Comercio controlado por el sector privado"; resp13[1] = "Comercio controlado por el Gobierno"; resp13[2] = "Diferencias de clases sociales"; resp13[3] = "El empleo es bien pagado"; opc1 = new JButton(resp13[0]); opc1.setBounds(50, 300, 290, 30); opc1.addActionListener(this); add(opc1); opc2 = new JButton(resp13[1]); opc2.setBounds(50, 350, 290, 30); opc2.addActionListener(this); add(opc2); opc3 = new JButton(resp13[2]); opc3.setBounds(50, 400, 290, 30); opc3.addActionListener(this); add(opc3); opc4 = new JButton(resp13[3]); opc4.setBounds(50, 450, 290, 30); opc4.addActionListener(this); add(opc4); titulo = new JLabel(preguntinis, SwingConstants.CENTER); titulo.setFont(new Font("Century Ghotic", Font.BOLD, 20)); titulo.setBounds(0, 90, 1080, 50); titulo.setHorizontalTextPosition(SwingConstants.CENTER); add(titulo); puntua = new JLabel("Score: " + s); puntua.setFont(new Font("Century Ghotic", Font.BOLD, 17)); puntua.setBounds(910, 600, 1080, 50); add(puntua); salir = new JButton("Salir"); salir.setBounds(50, 610, 100, 30); salir.addActionListener(this); add(salir); setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); fondo = new JLabel(); ImageIcon icon = new ImageIcon(getClass().getResource("/imagenes/imagen.jpg")); fondo.setIcon(icon); fondo.setBounds(0, 0, 1080, 720); add(fondo); setVisible(true); }
public void doLayout() { JLabel label; JComponent compo; CFJReferenceEditor reference; Dimension dim; final int spacing = 5; int y = spacing; final int height = 25; final int textheight = 80; final int vspacing = height + spacing; final int textvspacing = textheight + spacing; final int labelx = spacing; final int labelwidth = 200; final int fieldx = labelx + labelwidth + spacing; final int fieldwidth = 1024; Dimension jpsz = getSize(); int usefieldwidth = jpsz.width - 215; label = getSwingLabelContainerTenant(); label.setBounds(labelx, y, labelwidth, height); reference = getSwingReferenceContainerTenant(); reference.setBounds(fieldx, y, usefieldwidth, height); y = y + vspacing; label = getSwingLabelMenuId(); label.setBounds(labelx, y, labelwidth, height); compo = getSwingEditorMenuId(); dim = compo.getMaximumSize(); if (dim.width < usefieldwidth) { compo.setBounds(fieldx, y, dim.width, height); } else { compo.setBounds(fieldx, y, fieldwidth, height); } y = y + vspacing; label = getSwingLabelName(); label.setBounds(labelx, y, labelwidth, height); compo = getSwingEditorName(); dim = compo.getMaximumSize(); if (dim.width < usefieldwidth) { compo.setBounds(fieldx, y, dim.width, height); } else { compo.setBounds(fieldx, y, fieldwidth, height); } y = y + vspacing; label = getSwingLabelGreetLong(); label.setBounds(labelx, y, labelwidth, height); compo = getSwingEditorGreetLong(); dim = compo.getMaximumSize(); if (dim.width < usefieldwidth) { compo.setBounds(fieldx, y, dim.width, height); } else { compo.setBounds(fieldx, y, fieldwidth, height); } y = y + vspacing; label = getSwingLabelGreetShort(); label.setBounds(labelx, y, labelwidth, height); compo = getSwingEditorGreetShort(); dim = compo.getMaximumSize(); if (dim.width < usefieldwidth) { compo.setBounds(fieldx, y, dim.width, height); } else { compo.setBounds(fieldx, y, fieldwidth, height); } y = y + vspacing; label = getSwingLabelInvalidSound(); label.setBounds(labelx, y, labelwidth, height); compo = getSwingEditorInvalidSound(); dim = compo.getMaximumSize(); if (dim.width < usefieldwidth) { compo.setBounds(fieldx, y, dim.width, height); } else { compo.setBounds(fieldx, y, fieldwidth, height); } y = y + vspacing; label = getSwingLabelExitSound(); label.setBounds(labelx, y, labelwidth, height); compo = getSwingEditorExitSound(); dim = compo.getMaximumSize(); if (dim.width < usefieldwidth) { compo.setBounds(fieldx, y, dim.width, height); } else { compo.setBounds(fieldx, y, fieldwidth, height); } y = y + vspacing; label = getSwingLabelTimeout(); label.setBounds(labelx, y, labelwidth, height); compo = getSwingEditorTimeout(); dim = compo.getMaximumSize(); if (dim.width < usefieldwidth) { compo.setBounds(fieldx, y, dim.width, height); } else { compo.setBounds(fieldx, y, fieldwidth, height); } y = y + vspacing; label = getSwingLabelInterDigitTimeout(); label.setBounds(labelx, y, labelwidth, height); compo = getSwingEditorInterDigitTimeout(); dim = compo.getMaximumSize(); if (dim.width < usefieldwidth) { compo.setBounds(fieldx, y, dim.width, height); } else { compo.setBounds(fieldx, y, fieldwidth, height); } y = y + vspacing; label = getSwingLabelMaxFailures(); label.setBounds(labelx, y, labelwidth, height); compo = getSwingEditorMaxFailures(); dim = compo.getMaximumSize(); if (dim.width < usefieldwidth) { compo.setBounds(fieldx, y, dim.width, height); } else { compo.setBounds(fieldx, y, fieldwidth, height); } y = y + vspacing; label = getSwingLabelMaxTimeouts(); label.setBounds(labelx, y, labelwidth, height); compo = getSwingEditorMaxTimeouts(); dim = compo.getMaximumSize(); if (dim.width < usefieldwidth) { compo.setBounds(fieldx, y, dim.width, height); } else { compo.setBounds(fieldx, y, fieldwidth, height); } y = y + vspacing; label = getSwingLabelDigitLen(); label.setBounds(labelx, y, labelwidth, height); compo = getSwingEditorDigitLen(); dim = compo.getMaximumSize(); if (dim.width < usefieldwidth) { compo.setBounds(fieldx, y, dim.width, height); } else { compo.setBounds(fieldx, y, fieldwidth, height); } y = y + vspacing; }
// Initializes this component. private void jbInit() { fileChooser.setFileFilter(new ScriptFileFilter()); this.getContentPane().setLayout(null); Hashtable<Integer, JLabel> labelTable = new Hashtable<Integer, JLabel>(); JLabel slowLabel = new JLabel("Slow"); slowLabel.setFont(Utilities.thinLabelsFont); JLabel fastLabel = new JLabel("Fast"); fastLabel.setFont(Utilities.thinLabelsFont); labelTable.put(1, slowLabel); labelTable.put(5, fastLabel); speedSlider.addChangeListener( new ChangeListener() { public void stateChanged(ChangeEvent e) { SpeedSlider_stateChanged(e); } }); speedSlider.setLabelTable(labelTable); speedSlider.setMajorTickSpacing(1); speedSlider.setPaintTicks(true); speedSlider.setPaintLabels(true); speedSlider.setBorder(BorderFactory.createEmptyBorder(0, 0, 5, 0)); speedSlider.setPreferredSize(new Dimension(95, 50)); speedSlider.setMinimumSize(new Dimension(95, 50)); speedSlider.setToolTipText("Speed"); speedSlider.setMaximumSize(new Dimension(95, 50)); final Dimension buttonSize = new Dimension(39, 39); loadProgramButton.addActionListener( new ActionListener() { public void actionPerformed(ActionEvent e) { loadProgramButton_actionPerformed(); } }); loadProgramButton.setMaximumSize(buttonSize); loadProgramButton.setMinimumSize(buttonSize); loadProgramButton.setPreferredSize(buttonSize); loadProgramButton.setSize(buttonSize); loadProgramButton.setToolTipText("Load Program"); loadProgramButton.setIcon(loadProgramIcon); ffwdButton.setMaximumSize(buttonSize); ffwdButton.setMinimumSize(buttonSize); ffwdButton.setPreferredSize(buttonSize); ffwdButton.setToolTipText("Run"); ffwdButton.setIcon(ffwdIcon); ffwdButton.addActionListener( new ActionListener() { public void actionPerformed(ActionEvent e) { ffwdButton_actionPerformed(); } }); stopButton.addActionListener( new ActionListener() { public void actionPerformed(ActionEvent e) { stopButton_actionPerformed(); } }); stopButton.setMaximumSize(buttonSize); stopButton.setMinimumSize(buttonSize); stopButton.setPreferredSize(buttonSize); stopButton.setToolTipText("Stop"); stopButton.setIcon(stopIcon); rewindButton.setMaximumSize(buttonSize); rewindButton.setMinimumSize(buttonSize); rewindButton.setPreferredSize(buttonSize); rewindButton.setToolTipText("Reset"); rewindButton.setIcon(rewindIcon); rewindButton.addActionListener( new ActionListener() { public void actionPerformed(ActionEvent e) { rewindButton_actionPerformed(); } }); scriptButton.setMaximumSize(buttonSize); scriptButton.setMinimumSize(buttonSize); scriptButton.setPreferredSize(buttonSize); scriptButton.setToolTipText("Load Script"); scriptButton.setIcon(scriptIcon); scriptButton.addActionListener( new ActionListener() { public void actionPerformed(ActionEvent e) { scriptButton_actionPerformed(); } }); breakButton.addActionListener( new ActionListener() { public void actionPerformed(ActionEvent e) { breakButton_actionPerformed(); } }); breakButton.setMaximumSize(buttonSize); breakButton.setMinimumSize(buttonSize); breakButton.setPreferredSize(buttonSize); breakButton.setToolTipText("Open breakpoint panel"); breakButton.setIcon(breakIcon); breakpointWindow.addBreakpointListener(this); singleStepButton.addActionListener( new ActionListener() { public void actionPerformed(ActionEvent e) { singleStepButton_actionPerformed(); } }); singleStepButton.setMaximumSize(buttonSize); singleStepButton.setMinimumSize(buttonSize); singleStepButton.setPreferredSize(buttonSize); singleStepButton.setSize(buttonSize); singleStepButton.setToolTipText("Single Step"); singleStepButton.setIcon(singleStepIcon); stepOverButton.addActionListener( new ActionListener() { public void actionPerformed(ActionEvent e) { stepOverButton_actionPerformed(); } }); stepOverButton.setMaximumSize(buttonSize); stepOverButton.setMinimumSize(buttonSize); stepOverButton.setPreferredSize(buttonSize); stepOverButton.setSize(buttonSize); stepOverButton.setToolTipText("Step Over"); stepOverButton.setIcon(stepOverIcon); animationCombo.addActionListener( new java.awt.event.ActionListener() { public void actionPerformed(ActionEvent e) { animationCombo_actionPerformed(); } }); formatCombo.addActionListener( new java.awt.event.ActionListener() { public void actionPerformed(ActionEvent e) { formatCombo_actionPerformed(); } }); additionalDisplayCombo.addActionListener( new ActionListener() { public void actionPerformed(ActionEvent e) { additionalDisplayCombo_actionPerformed(); } }); messageLbl.setFont(Utilities.statusLineFont); messageLbl.setBorder(BorderFactory.createLoweredBevelBorder()); messageLbl.setBounds(new Rectangle(0, 667, CONTROLLER_WIDTH - 8, 25)); toolBar = new JToolBar(); toolBar.setSize(new Dimension(TOOLBAR_WIDTH, TOOLBAR_HEIGHT)); toolBar.setLayout(new FlowLayout(FlowLayout.LEFT, 3, 0)); toolBar.setFloatable(false); toolBar.setLocation(0, 0); toolBar.setBorder(BorderFactory.createEtchedBorder()); arrangeToolBar(); this.getContentPane().add(toolBar, null); toolBar.revalidate(); toolBar.repaint(); repaint(); // Creating the menu bar menuBar = new JMenuBar(); arrangeMenu(); setJMenuBar(menuBar); this.setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE); this.getContentPane().add(messageLbl, null); setControllerSize(); // sets the frame to be visible. setVisible(true); }
public IUmenu(String host) { setTitle("GUUERRA_NAVAL"); efectos = new Efectos(); try { cliente = new Cliente(host); } catch (Exception ex) { } /* Titulo */ titulo = new JLabel(" JHONMAN "); titulo.setForeground(Color.BLACK); titulo.setFont(new Font("Algerian", Font.BOLD, 24)); titulo.setBounds(120, 40, 560, 40); titulo.setHorizontalAlignment(JLabel.CENTER); /* MeEnu de Opciones */ mEnU = new JLabel("MENU DE OPCIONES"); mEnU.setForeground(Color.BLACK); mEnU.setFont(new Font("Algerian", Font.BOLD, 24)); mEnU.setBounds(40, 135, 390, 40); mEnU.setHorizontalAlignment(JLabel.LEFT); ImageIcon i = new ImageIcon("imagenes/apariencia/fondo_def.jpg"); fondo = new JLabel(new ImageIcon(i.getImage().getScaledInstance(800, 600, Image.SCALE_SMOOTH))); fondo.setBounds(0, 0, 800, 600); ImageIcon i1 = new ImageIcon("imagenes/apariencia/botRegistrar.jpg"); ImageIcon i2 = new ImageIcon("imagenes/apariencia/botPrincipiante.jpg"); ImageIcon i3 = new ImageIcon("imagenes/apariencia/botDificil.jpg"); ImageIcon i4 = new ImageIcon("imagenes/apariencia/botSalir.jpg"); ImageIcon i5 = new ImageIcon("imagenes/apariencia/botRaking.jpg"); ImageIcon i6 = new ImageIcon("imagenes/apariencia/brJuegoRed2.jpg"); ImageIcon i11 = new ImageIcon("imagenes/apariencia/botRegistrar2.jpg"); ImageIcon i22 = new ImageIcon("imagenes/apariencia/botPrincipiante2.jpg"); ImageIcon i33 = new ImageIcon("imagenes/apariencia/botDificil2.jpg"); ImageIcon i44 = new ImageIcon("imagenes/apariencia/botSalir2.jpg"); ImageIcon i55 = new ImageIcon("imagenes/apariencia/botRaking2.jpg"); ImageIcon i66 = new ImageIcon("imagenes/apariencia/brJuegoRed.jpg"); /* Boton Puntajes */ estad = new JButton(new ImageIcon(i5.getImage().getScaledInstance(170, 40, Image.SCALE_SMOOTH))); estad.setBounds(98, 148, 170, 40); estad.setRolloverIcon( new ImageIcon( i55.getImage() .getScaledInstance( 170, 40, Image .SCALE_SMOOTH))); // cuando el mouse esta sobre el boton cambia a esta // imagen estad.setBorderPainted(false); // elimino los bordes de el boton estad.addActionListener(this); estad.setMnemonic(KeyEvent.VK_P); estad.setToolTipText("ver Raking ALT + P"); /* Boton Registrar */ registrar = new JButton(new ImageIcon(i1.getImage().getScaledInstance(170, 40, Image.SCALE_SMOOTH))); registrar.setBounds(98, 205, 170, 40); registrar.setRolloverIcon( new ImageIcon(i11.getImage().getScaledInstance(170, 40, Image.SCALE_SMOOTH))); registrar.setBorderPainted(false); registrar.addActionListener(this); registrar.setMnemonic(KeyEvent.VK_Q); registrar.setToolTipText("Registrarse ALT + Q"); /* Boton TipoFacil */ facil = new JButton(new ImageIcon(i2.getImage().getScaledInstance(170, 40, Image.SCALE_SMOOTH))); facil.setBounds(97, 262, 170, 40); facil.setRolloverIcon( new ImageIcon(i22.getImage().getScaledInstance(170, 40, Image.SCALE_SMOOTH))); facil.setBorderPainted(false); facil.addActionListener(this); facil.setMnemonic(KeyEvent.VK_F); facil.setToolTipText("jugar en modo principiante ALT + F"); /* Boton TipoDificil */ dific = new JButton(new ImageIcon(i3.getImage().getScaledInstance(170, 40, Image.SCALE_SMOOTH))); dific.setBounds(97, 317, 170, 40); dific.setRolloverIcon( new ImageIcon(i33.getImage().getScaledInstance(170, 40, Image.SCALE_SMOOTH))); dific.setBorderPainted(false); dific.addActionListener(this); dific.setMnemonic(KeyEvent.VK_D); dific.setToolTipText("jugar en modo dificil ALT + D"); /* Boton Salir */ salir = new JButton(new ImageIcon(i4.getImage().getScaledInstance(170, 40, Image.SCALE_SMOOTH))); salir.setBounds(97, 430, 170, 40); salir.setRolloverIcon( new ImageIcon(i44.getImage().getScaledInstance(170, 40, Image.SCALE_SMOOTH))); salir.setBorderPainted(false); salir.addActionListener(this); salir.setMnemonic(KeyEvent.VK_S); salir.setToolTipText("Salir ALT + S"); /* Boton Red */ red = new JButton(new ImageIcon(i6.getImage().getScaledInstance(170, 40, Image.SCALE_SMOOTH))); red.setBounds(97, 374, 170, 40); red.setRolloverIcon( new ImageIcon(i66.getImage().getScaledInstance(170, 40, Image.SCALE_SMOOTH))); red.setBorderPainted(false); red.addActionListener(this); red.setMnemonic(KeyEvent.VK_C); red.setToolTipText("Jugar con varios jugadores ALT + C"); c = getContentPane(); c.setLayout(null); c.add(titulo); c.add(estad); c.add(facil); c.add(registrar); c.add(dific); c.add(salir); c.add(red); c.add(fondo); }
Library() { super("Library Management"); frame = this; try { UIManager.setLookAndFeel("com.sun.java.swing.plaf.windows.WindowsLookAndFeel"); } catch (Exception de) { } cp = getContentPane(); cp.setLayout(null); // Adding TextArea in Panel jp1 = new JPanel(null, true); // t1=new // JTextField("|Name "+"\t\t"+" |Author"+"\t\t "+" |Publication "+"\t"+"|Issue // "+"\t"+"|Return "+"\t"+"| Cutm. Id"); // t1.setEditable(false); // t1.setBounds(0,0,600,20); // jp1.add(t1); MenuBar mb = new MenuBar(); setMenuBar(mb); Menu menu2 = new Menu("Skins"); MenuItem item4 = new MenuItem("Defualt Skin"); MenuItem item5 = new MenuItem("Metal Skin"); MenuItem item6 = new MenuItem("Modified Skin"); // item5.setSelected(true); menu2.add(item4); menu2.add(item5); menu2.add(item6); mb.add(menu2); Menu menu21 = new Menu("Backup"); MenuItem item61 = new MenuItem("Create Database Backup"); menu21.add(item61); mb.add(menu21); // Menu menu1=new Menu("About"); // MenuItem item1=new MenuItem("Help ?"); // MenuItem item2=new MenuItem("Support ?"); // MenuItem item3=new MenuItem("About Us ?"); // menu1.add(item1);menu1.add(item2);menu1.add(item3); // mb.add(menu1); Menu menu212 = new Menu("Exit"); MenuItem item612 = new MenuItem("Exit Form Library"); menu212.add(item612); mb.add(menu212); int h = ScrollPaneConstants.HORIZONTAL_SCROLLBAR_ALWAYS; int v = ScrollPaneConstants.VERTICAL_SCROLLBAR_ALWAYS; Color re = new Color(122, 145, 201); mo1 = new DefaultListModel(); list1 = new JList(mo1); ml1 = new JLabel(" Book's Name"); ml1.setForeground(Color.red); ml1.setBounds(15, 0, 154, 20); list1.setBounds(15, 20, 154, 500); list1.setToolTipText("NAme of Book's Present in Database"); jp1.add(ml1); jp1.add(list1); mo2 = new DefaultListModel(); list2 = new JList(mo2); ml2 = new JLabel(" Author"); ml2.setForeground(re); ml2.setBounds(140 + 30, 0, 99, 20); list2.setToolTipText("Name of Book Author's Present in Database"); list2.setBounds(140 + 30, 20, 99, 900); jp1.add(ml2); jp1.add(list2); mo3 = new DefaultListModel(); list3 = new JList(mo3); ml3 = new JLabel(" Publication"); ml3.setForeground(re); ml3.setBounds(240 + 30, 0, 99, 20); list3.setToolTipText("Name of Book's Publication Present in Database"); list3.setBounds(240 + 30, 20, 99, 500); jp1.add(ml3); jp1.add(list3); mo4 = new DefaultListModel(); list4 = new JList(mo4); ml4 = new JLabel(" Issue Date"); ml4.setForeground(re); ml4.setBounds(340 + 30, 0, 70, 20); list4.setToolTipText("Date of Issue Present in Database"); list4.setBounds(340 + 30, 20, 70, 500); jp1.add(ml4); jp1.add(list4); mo5 = new DefaultListModel(); list5 = new JList(mo5); ml5 = new JLabel(" Return Date"); ml5.setForeground(re); ml5.setBounds(411 + 30, 0, 70, 20); list5.setToolTipText("Date of Return Present in Database"); list5.setBounds(411 + 30, 20, 70, 500); jp1.add(ml5); jp1.add(list5); mo6 = new DefaultListModel(); list6 = new JList(mo6); ml6 = new JLabel(" Cust. ID"); ml6.setForeground(re); ml6.setBounds(482 + 30, 0, 60, 20); list6.setToolTipText("ID of customer that purchase the book last time "); list6.setBounds(482 + 30, 20, 60, 500); jp1.add(ml6); jp1.add(list6); // a1=new JTextArea(); // a1.setText("|Name "+"\t\t\t"+" |Author"+"\t\t\t"+" |Publication "+"\t\t"+"|Issue // "+"\t\t"+"|Return "+"\t\t"+"| Cutm. Id"); // a1.setEditable(false); // JScrollPane scroll=new JScrollPane(a1,v,h); // scroll.setBounds(0,20,600,578); // jp1.add(scroll); for (int x = 1; x < 100; x++) { sr = new JLabel(x + "\n"); sr.setForeground(re); sr.setBounds(0, 20, 10, 500); jp1.add(sr); } // jp1.setBackground(Color.black); JScrollPane nm = new JScrollPane(jp1, v, h); nm.setBounds(10, 20, 600, 500); cp.add(nm); jp2 = new JPanel(null, true); b1 = new JButton("Add Book"); b1.setBounds(10, 10, 120, 25); jp2.add(b1); b2 = new JButton("Delete Book"); b2.setBounds(10, 45, 120, 25); jp2.add(b2); b3 = new JButton("View Book Details"); b3.setBounds(10, 80, 120, 25); jp2.add(b3); b4 = new JButton("View All Book's"); b4.setBounds(10, 115, 120, 25); jp2.add(b4); Color r = new Color(122, 145, 201); jp2.setBackground(r); jp2.setBounds(630, 20, 160, 145); cp.add(jp2); jp3 = new JPanel(null, true); t1 = new JTextField(); t1.setBounds(10, 10, 120, 20); jp3.add(t1); t1.setToolTipText("Find The Book By Book Name. It is Advaced Search System"); b5 = new JButton("Search Book Name"); b5.setBounds(05, 35, 130, 20); jp3.add(b5); // b5.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_N,Event.CTRL_MASK)); b5.setMnemonic(KeyEvent.VK_N); JLabel lk = new JLabel("__________________________________"); lk.setForeground(Color.black); lk.setBounds(0, 50, 160, 6); jp3.add(lk); t14 = new JTextField(); t14.setBounds(10, 60, 120, 20); jp3.add(t14); t14.setToolTipText("Find The Book By Author Name. It is Advaced Search System"); b10 = new JButton("Search Author"); b10.setBounds(05, 85, 130, 20); jp3.add(b10); // b10.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_a,Event.CTRL_MASK)); b10.setMnemonic(KeyEvent.VK_N); Color r1 = new Color(122, 145, 201); jp3.setBackground(r1); jp3.setBounds(630, 180, 160, 115); cp.add(jp3); jp4 = new JPanel(null, true); b15 = new JButton("Add Customer"); b15.setBounds(10, 05, 120, 25); jp4.add(b15); b6 = new JButton("View all Cotumers"); b6.setBounds(10, 35, 120, 25); jp4.add(b6); t2 = new JTextField(); t2.setBounds(10, 65, 120, 20); t2.setToolTipText("Find The Customer Information. It is Advaced Search System"); jp4.add(t2); b7 = new JButton("Search"); b7.setBounds(05, 90, 130, 20); jp4.add(b7); b8 = new JButton("Delete Costumer"); b8.setBounds(10, 115, 120, 25); jp4.add(b8); b9 = new JButton("View Cust. Details"); b9.setBounds(10, 150, 120, 25); jp4.add(b9); Color r3 = new Color(122, 145, 201); jp4.setBackground(r3); jp4.setBounds(630, 305, 160, 180); cp.add(jp4); b_no = new JLabel(); b_no.setForeground(Color.red); b_no.setBounds(150, 0, 150, 20); cp.add(b_no); progress1 = new JProgressBar(); progress1.setBackground(re); progress1.setBounds(630, 490, 150, 25); cp.add(progress1); try { rd1 = new FileReader("Database/pointer.mmm"); read1 = new JTextField(); read1.read(rd1, null); int count = Integer.parseInt(read1.getText()); int total = count - 1; int blk = 0; rd1.close(); for (int i = 1; i < count; i++) { rd1 = new FileReader("Database/" + i + ".name"); read1 = new JTextField(); read1.read(rd1, null); if (!read1.getText().equals("")) { blk++; b_no.setText("Total Books = " + blk + " (Book's)"); mo1.addElement(read1.getText() + ""); rd1.close(); int per = i * 100 / total; progress1.setValue(per); rd1 = new FileReader("Database/" + i + ".author"); read1 = new JTextField(); read1.read(rd1, null); mo2.addElement(read1.getText() + ""); rd1.close(); rd1 = new FileReader("Database/" + i + ".publication"); read1 = new JTextField(); read1.read(rd1, null); mo3.addElement(read1.getText() + ""); rd1.close(); rd1 = new FileReader("Database/" + i + ".issue"); read1 = new JTextField(); read1.read(rd1, null); if (!read1.getText().equals("")) { mo4.addElement(read1.getText() + ""); } else { mo4.addElement(read1.getText() + " -"); } rd1.close(); rd1 = new FileReader("Database/" + i + ".return"); read1 = new JTextField(); read1.read(rd1, null); mo5.addElement(read1.getText() + ""); rd1.close(); rd1 = new FileReader("Database/" + i + ".id"); read1 = new JTextField(); read1.read(rd1, null); mo6.addElement(read1.getText() + ""); rd1.close(); } } } catch (Exception der) { a1.setText("Error Occurs: \n" + der); } // Source code for searching the book's from Database // it search book by name of book,author,publication // it work when you don't know about any thing than press any // keyword to find book/ // eg: if you have book name that publish by that publication which // starts from "c" // then you press only "c" in search it show you all Books that start // with "c" ,Author "c" and publication that start "c" . // Warning: // Don't Modify the code without knowledge of full source code // Author : Pravin Rane b5.addActionListener( new ActionListener() { public void actionPerformed(ActionEvent e) { try { int bs1 = 0; progress1.setValue(0); mo1.removeAllElements(); mo2.removeAllElements(); mo3.removeAllElements(); mo4.removeAllElements(); mo5.removeAllElements(); mo6.removeAllElements(); ml1.setText("Book Name"); ml2.setText("Author"); ml3.setText("Publication"); ml4.setText("Issue Date"); ml5.setText("Return Date"); ml6.setText("Cust. ID."); if (!t1.getText().equals("")) { rd1 = new FileReader("Database/pointer.mmm"); read1 = new JTextField(); read1.read(rd1, null); int no = Integer.parseInt(read1.getText()); rd1.close(); int len = t1.getText().length(); for (int k = 0; k < len; k++) { char ch = t1.getText().charAt(k); stra1 = stra1 + ch; // System.out.println(stra1+""); } for (int v = 1; v < no; v++) { name11 = ""; author11 = ""; publication11 = ""; progress1.setMaximum(no); int per = v * 100 / no; progress1.updateUI(); progress1.setValue(per); FileReader re1 = new FileReader("Database/" + v + ".name"); JTextField jt1 = new JTextField(); jt1.read(re1, null); String name = jt1.getText(); re1.close(); FileReader re2 = new FileReader("Database/" + v + ".author"); JTextField jt2 = new JTextField(); jt2.read(re2, null); String author = jt2.getText(); re2.close(); FileReader re3 = new FileReader("Database/" + v + ".publication"); JTextField jt3 = new JTextField(); jt3.read(re3, null); String publication = jt3.getText(); re3.close(); find = v; try { for (int z = 0; z < len; z++) { name11 = name11 + name.charAt(z); // author11=author11+author.charAt(z); // System.out.println(author11+""); publication11 = publication11 + publication.charAt(z); if (z == (len - 1)) { // System.out.println(name11+""); // System.out.println(publication11+""); } } } catch (Exception def) { } if (name.toLowerCase().equals(t1.getText()) || name.toUpperCase().equals(t1.getText()) || author.toLowerCase().equals(t1.getText()) || author.toUpperCase().equals(t1.getText()) || publication.toLowerCase().equals(t1.getText()) || publication.toUpperCase().equals(t1.getText())) { bs1++; rd1 = new FileReader("Database/" + find + ".name"); read1 = new JTextField(); read1.read(rd1, null); mo1.addElement(read1.getText() + ""); rd1.close(); rd1 = new FileReader("Database/" + find + ".author"); read1 = new JTextField(); read1.read(rd1, null); mo2.addElement(read1.getText() + ""); rd1.close(); rd1 = new FileReader("Database/" + find + ".publication"); read1 = new JTextField(); read1.read(rd1, null); mo3.addElement(read1.getText() + ""); rd1.close(); rd1 = new FileReader("Database/" + find + ".issue"); read1 = new JTextField(); read1.read(rd1, null); mo4.addElement(read1.getText() + ""); rd1.close(); rd1 = new FileReader("Database/" + find + ".return"); read1 = new JTextField(); read1.read(rd1, null); mo5.addElement(read1.getText() + ""); rd1.close(); rd1 = new FileReader("Database/" + find + ".id"); read1 = new JTextField(); read1.read(rd1, null); mo6.addElement(read1.getText() + ""); rd1.close(); } else if (publication11.toLowerCase().equals(t1.getText()) || author11.toLowerCase().equals(t1.getText()) || name11.toLowerCase().equals(t1.getText()) || publication11.toUpperCase().equals(t1.getText()) || author11.toUpperCase().equals(t1.getText()) || name11.toUpperCase().equals(t1.getText())) { bs1++; rd1 = new FileReader("Database/" + find + ".name"); read1 = new JTextField(); read1.read(rd1, null); mo1.addElement(read1.getText() + ""); rd1.close(); rd1 = new FileReader("Database/" + find + ".author"); read1 = new JTextField(); read1.read(rd1, null); mo2.addElement(read1.getText() + ""); rd1.close(); rd1 = new FileReader("Database/" + find + ".publication"); read1 = new JTextField(); read1.read(rd1, null); mo3.addElement(read1.getText() + ""); rd1.close(); rd1 = new FileReader("Database/" + find + ".issue"); read1 = new JTextField(); read1.read(rd1, null); mo4.addElement(read1.getText() + ""); rd1.close(); rd1 = new FileReader("Database/" + find + ".return"); read1 = new JTextField(); read1.read(rd1, null); mo5.addElement(read1.getText() + ""); rd1.close(); rd1 = new FileReader("Database/" + find + ".id"); read1 = new JTextField(); read1.read(rd1, null); mo6.addElement(read1.getText() + ""); rd1.close(); } b_no.setText("Total Book Found =" + bs1 + " (Book's)"); } } else { progress1.setValue(0); JOptionPane.showMessageDialog( (Component) null, "Please Enter the Book Name or Publcation", "Library Management(Pravin Rane)", JOptionPane.OK_OPTION); b_no.setText("User Input Error!"); } } catch (Exception der) { System.out.println("Error:" + der); } } }); b10.addActionListener( new ActionListener() { public void actionPerformed(ActionEvent e) { try { int bs2 = 0; progress1.setValue(0); mo1.removeAllElements(); mo2.removeAllElements(); mo3.removeAllElements(); mo4.removeAllElements(); mo5.removeAllElements(); mo6.removeAllElements(); ml1.setText("Book Name"); ml2.setText("Author"); ml3.setText("Publication"); ml4.setText("Issue Date"); ml5.setText("Return Date"); ml6.setText("Cust. ID."); if (!t14.getText().equals("")) { rd1 = new FileReader("Database/pointer.mmm"); read1 = new JTextField(); read1.read(rd1, null); int no = Integer.parseInt(read1.getText()); rd1.close(); int len = t14.getText().length(); for (int k = 0; k < len; k++) { char ch = t14.getText().charAt(k); stra1 = stra1 + ch; // System.out.println(stra1+""); } for (int v = 1; v < no; v++) { name11 = ""; author11 = ""; publication11 = ""; progress1.setMaximum(no); int per = v * 100 / no; progress1.updateUI(); progress1.setValue(per); FileReader re1 = new FileReader("Database/" + v + ".name"); JTextField jt1 = new JTextField(); jt1.read(re1, null); String name = jt1.getText(); re1.close(); FileReader re2 = new FileReader("Database/" + v + ".author"); JTextField jt2 = new JTextField(); jt2.read(re2, null); String author = jt2.getText(); re2.close(); FileReader re3 = new FileReader("Database/" + v + ".publication"); JTextField jt3 = new JTextField(); jt3.read(re3, null); String publication = jt3.getText(); re3.close(); find = v; try { for (int z = 0; z < len; z++) { // name11=name11+name.charAt(z); author11 = author11 + author.charAt(z); // System.out.println(author11+""); // publication11=publication11+publication.charAt(z); if (z == (len - 1)) { // System.out.println(name11+""); // System.out.println(publication11+""); } } } catch (Exception def) { } if (author.toLowerCase().equals(t14.getText()) || author.toUpperCase().equals(t14.getText())) { bs2++; rd1 = new FileReader("Database/" + find + ".name"); read1 = new JTextField(); read1.read(rd1, null); mo1.addElement(read1.getText() + ""); rd1.close(); rd1 = new FileReader("Database/" + find + ".author"); read1 = new JTextField(); read1.read(rd1, null); mo2.addElement(read1.getText() + ""); rd1.close(); rd1 = new FileReader("Database/" + find + ".publication"); read1 = new JTextField(); read1.read(rd1, null); mo3.addElement(read1.getText() + ""); rd1.close(); rd1 = new FileReader("Database/" + find + ".issue"); read1 = new JTextField(); read1.read(rd1, null); mo4.addElement(read1.getText() + ""); rd1.close(); rd1 = new FileReader("Database/" + find + ".return"); read1 = new JTextField(); read1.read(rd1, null); mo5.addElement(read1.getText() + ""); rd1.close(); rd1 = new FileReader("Database/" + find + ".id"); read1 = new JTextField(); read1.read(rd1, null); mo6.addElement(read1.getText() + ""); rd1.close(); } else if (author11.toLowerCase().equals(t14.getText()) || author11.toUpperCase().equals(t14.getText())) { bs2++; rd1 = new FileReader("Database/" + find + ".name"); read1 = new JTextField(); read1.read(rd1, null); mo1.addElement(read1.getText() + ""); rd1.close(); rd1 = new FileReader("Database/" + find + ".author"); read1 = new JTextField(); read1.read(rd1, null); mo2.addElement(read1.getText() + ""); rd1.close(); rd1 = new FileReader("Database/" + find + ".publication"); read1 = new JTextField(); read1.read(rd1, null); mo3.addElement(read1.getText() + ""); rd1.close(); rd1 = new FileReader("Database/" + find + ".issue"); read1 = new JTextField(); read1.read(rd1, null); mo4.addElement(read1.getText() + ""); rd1.close(); rd1 = new FileReader("Database/" + find + ".return"); read1 = new JTextField(); read1.read(rd1, null); mo5.addElement(read1.getText() + ""); rd1.close(); rd1 = new FileReader("Database/" + find + ".id"); read1 = new JTextField(); read1.read(rd1, null); mo6.addElement(read1.getText() + ""); rd1.close(); } b_no.setText("Total Book Found =" + bs2 + " (Book's)"); } } else { progress1.setValue(0); b_no.setText("User Input Error!"); JOptionPane.showMessageDialog( (Component) null, "Please Enter the Book Author name", "Library Management(Pravin Rane)", JOptionPane.OK_OPTION); } } catch (Exception der) { System.out.println("Error:" + der); } } }); // End of Serching Book // Author : Pravin Rane // it use to aplly the skins to UserInteface // there are three skins Default which is Windows Skin // Metal skin and modified skin. // apply it as oer ur requirment. // Author : Pravin H. Rane item4.addActionListener( new ActionListener() { public void actionPerformed(ActionEvent e) { try { UIManager.setLookAndFeel("com.sun.java.swing.plaf.windows.WindowsLookAndFeel"); SwingUtilities.updateComponentTreeUI(frame); } catch (Exception dert) { System.out.println(dert); } } }); item5.addActionListener( new ActionListener() { public void actionPerformed(ActionEvent e) { try { UIManager.setLookAndFeel("javax.swing.plaf.metal.MetalLookAndFeel"); SwingUtilities.updateComponentTreeUI(frame); } catch (Exception dert) { System.out.println(dert); } } }); item6.addActionListener( new ActionListener() { public void actionPerformed(ActionEvent e) { try { UIManager.setLookAndFeel("com.sun.java.swing.plaf.motif.MotifLookAndFeel"); SwingUtilities.updateComponentTreeUI(frame); } catch (Exception dert) { System.out.println(dert); } } }); item61.addActionListener( new ActionListener() { public void actionPerformed(ActionEvent e) { try { Date d = new Date(); int my1 = d.getDate(); int my2 = d.getMonth(); FileDialog fd = new FileDialog(frame, "Save Database Backup File (Library Management )"); fd.setMode(FileDialog.SAVE); fd.setFile("Database" + my1 + "." + my2 + ".rar"); fd.setVisible(true); String dir = fd.getDirectory(); String path = fd.getFile(); String command = "jar cvf Database1.rar Database/*.*"; Runtime r = Runtime.getRuntime(); r.exec(command); String command2 = "jar cvf Database2.rar Cust_Details/*.*"; Runtime r2 = Runtime.getRuntime(); r2.exec(command2); try { Thread.sleep(1000); } catch (Exception fr) { } String command3 = "jar cvf " + dir + path + " Database1.rar Database2.rar"; Runtime r3 = Runtime.getRuntime(); r3.exec(command3); System.out.println("Database Backup Sucessfully!"); } catch (Exception dert) { System.out.println(dert); } } }); item612.addActionListener( new ActionListener() { public void actionPerformed(ActionEvent e) { System.exit(0); } }); // End Of Applyinf Skin to UInterface // This Button show the details of Book's // that specified when the book is adding in the database // you can modify the details of book. // Author : Pravin H. Rane b3.addActionListener( new ActionListener() { public void actionPerformed(ActionEvent e) { try { // view v=new view(String str,string info,boolean val); } catch (Exception der) { } } }); // End of book details b15.addActionListener( new ActionListener() { public void actionPerformed(ActionEvent e) { Addcust ad = new Addcust(); ad.setVisible(true); ad.setSize(380, 400); ad.setLocation(80, 140); } }); // it show all book's available in database // it dosn't sort book by sequensely // you can modify the code for sorting the book as per your requirement // Author : Pravin b1.addActionListener( new ActionListener() { public void actionPerformed(ActionEvent e) { addBook a = new addBook(); } }); b4.addActionListener( new ActionListener() { public void actionPerformed(ActionEvent e) { try { mo1.removeAllElements(); mo2.removeAllElements(); mo3.removeAllElements(); mo4.removeAllElements(); mo5.removeAllElements(); mo6.removeAllElements(); ml1.setText("Book Name"); ml2.setText("Author"); ml3.setText("Publication"); ml4.setText("Issue Date"); ml5.setText("Return Date"); ml6.setText("Cust. ID."); int za = 0; rd1 = new FileReader("Database/pointer.mmm"); read1 = new JTextField(); read1.read(rd1, null); int count = Integer.parseInt(read1.getText()); int total = count - 1; rd1.close(); for (int i = 1; i < count; i++) { rd1 = new FileReader("Database/" + i + ".name"); read1 = new JTextField(); read1.read(rd1, null); if (!read1.getText().equals("")) { za++; b_no.setText("Total Books = " + za + " (Book's)"); mo1.addElement(read1.getText() + ""); rd1.close(); progress1.setMaximum(total); int per = i * 100 / total; progress1.setValue(per); rd1 = new FileReader("Database/" + i + ".author"); read1 = new JTextField(); read1.read(rd1, null); mo2.addElement(read1.getText() + ""); rd1.close(); rd1 = new FileReader("Database/" + i + ".publication"); read1 = new JTextField(); read1.read(rd1, null); mo3.addElement(read1.getText() + ""); rd1.close(); rd1 = new FileReader("Database/" + i + ".issue"); read1 = new JTextField(); read1.read(rd1, null); if (!read1.getText().equals("")) { mo4.addElement(read1.getText() + ""); } else { mo4.addElement(read1.getText() + " _"); } rd1.close(); rd1 = new FileReader("Database/" + i + ".return"); read1 = new JTextField(); read1.read(rd1, null); mo5.addElement(read1.getText() + ""); rd1.close(); rd1 = new FileReader("Database/" + i + ".id"); read1 = new JTextField(); read1.read(rd1, null); mo6.addElement(read1.getText() + ""); rd1.close(); progress1.setValue(100); } } } catch (Exception der) { a1.setText("Error Occurs: \n" + der); } } }); // End of View all Book's // This source code is used to show information of all customers // Author :Pravin Rane b6.addActionListener( new ActionListener() { public void actionPerformed(ActionEvent e) { try { ml1.setText("Cust. ID"); ml2.setText("Cust. Name"); ml3.setText("Registration Date"); ml4.setText("Book Name"); ml5.setText("Purchase Date"); ml6.setText("Return Date"); int z12 = 0; mo1.removeAllElements(); mo2.removeAllElements(); mo3.removeAllElements(); mo4.removeAllElements(); mo5.removeAllElements(); mo6.removeAllElements(); rd2 = new FileReader("Cust_Details/pointer.mmm"); jt2 = new JTextField(); jt2.read(rd2, null); rd2.close(); int no = Integer.parseInt(jt2.getText()); int tt = no - 1; // b_no.setText("Total Customer's :"+tt ); for (int v = 1; v < no; v++) { rd2 = new FileReader("Cust_Details/Cus" + v + ".id"); jt2 = new JTextField(); jt2.read(rd2, null); if (!jt2.getText().equals("")) { z12++; b_no.setText("Total Customers = " + z12); mo1.addElement(jt2.getText() + ""); rd2.close(); rd2 = new FileReader("Cust_Details/Cus" + v + ".name"); jt2 = new JTextField(); jt2.read(rd2, null); mo2.addElement(jt2.getText() + ""); rd2.close(); rd2 = new FileReader("Cust_Details/Cus" + v + ".date"); jt2 = new JTextField(); jt2.read(rd2, null); mo3.addElement(jt2.getText() + ""); rd2.close(); rd2 = new FileReader("Cust_Details/Cus" + v + ".bname"); jt2 = new JTextField(); jt2.read(rd2, null); if (!jt2.getText().equals("")) { mo4.addElement(jt2.getText() + ""); } else { mo4.addElement(jt2.getText() + " _"); } rd2.close(); rd2 = new FileReader("Cust_Details/Cus" + v + ".purchase"); jt2 = new JTextField(); jt2.read(rd2, null); if (!jt2.getText().equals("")) { mo5.addElement(jt2.getText() + ""); } else { mo5.addElement(jt2.getText() + " _"); } rd2.close(); rd2 = new FileReader("Cust_Details/Cus" + v + ".return"); jt2 = new JTextField(); jt2.read(rd2, null); if (!jt2.getText().equals("")) { mo6.addElement(jt2.getText() + ""); } else { mo6.addElement(jt2.getText() + " _"); } rd2.close(); } } } catch (Exception ser) { System.out.println(ser); } } }); // End of showing customer's Info. b9.addActionListener( new ActionListener() { public void actionPerformed(ActionEvent e) { try { int ad = list1.getSelectedIndex(); String str = (String) mo1.getElementAt(ad); System.out.println(str); cust_detail d = new cust_detail(str); d.setVisible(true); d.setSize(300, 550); d.setLocation(100, 0); } catch (Exception fr) { JOptionPane.showMessageDialog( (Component) null, "Please Select Customer ID from List of Cust. ID. ", "Library Management(Pravin Rane)", JOptionPane.OK_OPTION); try { ml1.setText("Cust. ID"); ml2.setText("Cust. Name"); ml3.setText("Registration Date"); ml4.setText("Book Name"); ml5.setText("Purchase Date"); ml6.setText("Return Date"); mo1.removeAllElements(); mo2.removeAllElements(); mo3.removeAllElements(); mo4.removeAllElements(); mo5.removeAllElements(); mo6.removeAllElements(); rd2 = new FileReader("Cust_Details/pointer.mmm"); jt2 = new JTextField(); jt2.read(rd2, null); rd2.close(); int no = Integer.parseInt(jt2.getText()); for (int v = 1; v < no; v++) { rd2 = new FileReader("Cust_Details/Cus" + v + ".id"); jt2 = new JTextField(); jt2.read(rd2, null); mo1.addElement(jt2.getText() + ""); rd2.close(); rd2 = new FileReader("Cust_Details/Cus" + v + ".name"); jt2 = new JTextField(); jt2.read(rd2, null); mo2.addElement(jt2.getText() + ""); rd2.close(); rd2 = new FileReader("Cust_Details/Cus" + v + ".date"); jt2 = new JTextField(); jt2.read(rd2, null); mo3.addElement(jt2.getText() + ""); rd2.close(); rd2 = new FileReader("Cust_Details/Cus" + v + ".bname"); jt2 = new JTextField(); jt2.read(rd2, null); if (!jt2.getText().equals("")) { mo4.addElement(jt2.getText() + ""); } else { mo4.addElement(jt2.getText() + " _"); } rd2.close(); rd2 = new FileReader("Cust_Details/Cus" + v + ".purchase"); jt2 = new JTextField(); jt2.read(rd2, null); if (!jt2.getText().equals("")) { mo5.addElement(jt2.getText() + ""); } else { mo5.addElement(jt2.getText() + " _"); } rd2.close(); rd2 = new FileReader("Cust_Details/Cus" + v + ".return"); jt2 = new JTextField(); jt2.read(rd2, null); if (!jt2.getText().equals("")) { mo6.addElement(jt2.getText() + ""); } else { mo6.addElement(jt2.getText() + " _"); } rd2.close(); } } catch (Exception fg) { } } } }); b7.addActionListener( new ActionListener() { public void actionPerformed(ActionEvent e) { String mysearchid = t2.getText(); try { ml1.setText("Cust. ID"); ml2.setText("Cust. Name"); ml3.setText("Registration Date"); ml4.setText("Book Name"); ml5.setText("Purchase Date"); ml6.setText("Return Date"); mo1.removeAllElements(); mo2.removeAllElements(); mo3.removeAllElements(); mo4.removeAllElements(); mo5.removeAllElements(); mo6.removeAllElements(); if (!t2.getText().equals("")) { rd2 = new FileReader("Cust_Details/pointer.mmm"); jt2 = new JTextField(); jt2.read(rd2, null); rd2.close(); int no = Integer.parseInt(jt2.getText()); int len3 = t2.getText().length(); for (int v = 1; v < no; v++) { name22 = ""; int lg = 0; rd2 = new FileReader("Cust_Details/Cus" + v + ".id"); jt2 = new JTextField(); jt2.read(rd2, null); // mo1.addElement(jt2.getText()+""); String s1 = jt2.getText(); rd2.close(); rd2 = new FileReader("Cust_Details/Cus" + v + ".name"); jt2 = new JTextField(); jt2.read(rd2, null); // mo2.addElement(jt2.getText()+""); String s2 = jt2.getText(); rd2.close(); for (int z = 0; z < len3; z++) { name22 = name22 + s2.charAt(z); } if (s1.toLowerCase().equals(mysearchid) || s1.toUpperCase().equals(mysearchid) || s2.toLowerCase().equals(mysearchid) || s2.toUpperCase().equals(mysearchid) || name22.toUpperCase().equals(mysearchid) || name22.toLowerCase().equals(mysearchid)) { lg++; b_no.setText("Customer Found :" + lg); rd2 = new FileReader("Cust_Details/Cus" + v + ".id"); jt2 = new JTextField(); jt2.read(rd2, null); mo1.addElement(jt2.getText() + ""); rd2.close(); rd2 = new FileReader("Cust_Details/Cus" + v + ".name"); jt2 = new JTextField(); jt2.read(rd2, null); mo2.addElement(jt2.getText() + ""); rd2.close(); rd2 = new FileReader("Cust_Details/Cus" + v + ".date"); jt2 = new JTextField(); jt2.read(rd2, null); mo3.addElement(jt2.getText() + ""); rd2.close(); rd2 = new FileReader("Cust_Details/Cus" + v + ".bname"); jt2 = new JTextField(); jt2.read(rd2, null); if (!jt2.getText().equals("")) { mo4.addElement(jt2.getText() + ""); } else { mo4.addElement(jt2.getText() + " _"); } rd2.close(); rd2 = new FileReader("Cust_Details/Cus" + v + ".purchase"); jt2 = new JTextField(); jt2.read(rd2, null); if (!jt2.getText().equals("")) { mo5.addElement(jt2.getText() + ""); } else { mo5.addElement(jt2.getText() + " _"); } rd2.close(); rd2 = new FileReader("Cust_Details/Cus" + v + ".return"); jt2 = new JTextField(); jt2.read(rd2, null); if (!jt2.getText().equals("")) { mo6.addElement(jt2.getText() + ""); } else { mo6.addElement(jt2.getText() + " _"); } rd2.close(); } } } else { progress1.setValue(0); b_no.setText("User Input Error!"); JOptionPane.showMessageDialog( (Component) null, "Please Enter Customer Id or Name", "Library Management(Pravin Rane)", JOptionPane.OK_OPTION); } } catch (Exception de) { } } }); b2.addActionListener( new ActionListener() { public void actionPerformed(ActionEvent e) { int ad = list1.getSelectedIndex(); String str99 = (String) mo1.getElementAt(ad); try { rd2 = new FileReader("Database/pointer.mmm"); jt2 = new JTextField(); jt2.read(rd2, null); rd2.close(); int nom = Integer.parseInt(jt2.getText()); for (int count2 = 1; count2 < nom; count2++) { rd1 = new FileReader("Database/" + count2 + ".name"); read1 = new JTextField(); read1.read(rd1, null); rd1.close(); if (read1.getText().equals(str99)) { wr1 = new FileWriter("Database/" + count2 + ".name"); wr1.write(""); wr1.close(); wr1 = new FileWriter("Database/" + count2 + ".author"); wr1.write(""); wr1.close(); wr1 = new FileWriter("Database/" + count2 + ".publication"); wr1.write(""); wr1.close(); wr1 = new FileWriter("Database/" + count2 + ".issue"); wr1.write(""); wr1.close(); wr1 = new FileWriter("Database/" + count2 + ".return"); wr1.write(""); wr1.close(); wr1 = new FileWriter("Database/" + count2 + ".detail"); wr1.write(""); wr1.close(); wr1 = new FileWriter("Database/" + count2 + ".id"); wr1.write(""); wr1.close(); try { Library lbc = new Library(); setVisible(false); lbc.setVisible(true); lbc.setSize(800, 600); } catch (Exception de) { } } } } catch (Exception fr) { System.out.println(fr); } } }); b3.addActionListener( new ActionListener() { public void actionPerformed(ActionEvent e) { try { int ad = list1.getSelectedIndex(); String str34 = (String) mo1.getElementAt(ad); jf55 = new JFrame("Book Details"); jf55.setVisible(true); jf55.setLayout(null); jf55.setLocation(160, 180); JTextArea ak47 = new JTextArea(); ak47.setEditable(false); ak47.setText( "Book Details" + "\n" + "**************************************************"); ak47.setBounds(10, 10, 250, 250); jf55.add(ak47); Button b1 = new Button("Ok"); b1.setBounds(80, 270, 100, 25); jf55.add(b1); b1.addActionListener( new ActionListener() { public void actionPerformed(ActionEvent e) { jf55.setVisible(false); } }); jf55.setSize(285, 335); rd2 = new FileReader("Database/pointer.mmm"); jt2 = new JTextField(); jt2.read(rd2, null); rd2.close(); int nov = Integer.parseInt(jt2.getText()); for (int i = 1; i < nov; i++) { rd1 = new FileReader("Database/" + i + ".name"); read1 = new JTextField(); read1.read(rd1, null); String hj = read1.getText(); rd1.close(); if (hj.equals(str34)) { rd1 = new FileReader("Database/" + i + ".name"); read1 = new JTextField(); read1.read(rd1, null); if (!read1.getText().equals("")) { ak47.setText(ak47.getText() + "\n" + "Book Name :" + read1.getText()); rd1.close(); rd1 = new FileReader("Database/" + i + ".author"); read1 = new JTextField(); read1.read(rd1, null); ak47.setText(ak47.getText() + "\n" + "Book Author :" + read1.getText()); rd1.close(); rd1 = new FileReader("Database/" + i + ".publication"); read1 = new JTextField(); read1.read(rd1, null); ak47.setText(ak47.getText() + "\n" + "Book Publication :" + read1.getText()); rd1.close(); rd1 = new FileReader("Database/" + i + ".issue"); read1 = new JTextField(); read1.read(rd1, null); if (!read1.getText().equals("")) { ak47.setText(ak47.getText() + "\n" + "Issue Date :" + read1.getText()); } else { ak47.setText(ak47.getText() + "\n" + "Issue Date : None"); } rd1.close(); rd1 = new FileReader("Database/" + i + ".return"); read1 = new JTextField(); read1.read(rd1, null); ak47.setText(ak47.getText() + "\n" + "Return Date :" + read1.getText()); rd1.close(); rd1 = new FileReader("Database/" + i + ".id"); read1 = new JTextField(); read1.read(rd1, null); ak47.setText(ak47.getText() + "\n" + "Cust. Id :" + read1.getText()); rd1.close(); rd1 = new FileReader("Database/" + i + ".detail"); read1 = new JTextField(); read1.read(rd1, null); if (!read1.getText().equals("")) { ak47.setText(ak47.getText() + "\n" + "Other Details : \n" + read1.getText()); } else { ak47.setText(ak47.getText() + "\n" + "Other Details : Not Found"); } rd1.close(); } } } } catch (Exception de) { JOptionPane.showMessageDialog( (Component) null, "Please Select Book Name from List", "Library Management(Pravin Rane)", JOptionPane.OK_OPTION); } } }); }
void createFrame() { /* see Preferences.java */ int GUI_BIG = 13; int GUI_BETWEEN = 10; int GUI_SMALL = 6; int FIELD_SIZE = 30; int left = GUI_BIG; int top = GUI_BIG; int right = 0; Dimension d; frame = new JFrame("Directives Editor"); Container pane = frame.getContentPane(); pane.setLayout(null); JLabel label = new JLabel("Click here to read about directives."); label.addMouseListener( new MouseListener() { public void mouseClicked(MouseEvent e) { Base.openURL("http://processingjs.org/reference/pjs%20directive"); } public void mouseEntered(MouseEvent e) {} public void mouseExited(MouseEvent e) {} public void mousePressed(MouseEvent e) {} public void mouseReleased(MouseEvent e) {} }); pane.add(label); d = label.getPreferredSize(); label.setBounds(left, top, d.width, d.height); top += d.height + GUI_BETWEEN + GUI_BETWEEN; // CRISP crispBox = new JCheckBox("\"crisp\": disable antialiasing for line(), triangle() and rect()"); pane.add(crispBox); d = crispBox.getPreferredSize(); crispBox.setBounds(left, top, d.width + 10, d.height); right = Math.max(right, left + d.width); top += d.height + GUI_BETWEEN; // FONTS label = new JLabel("\"font\": to load (comma separated)"); pane.add(label); d = label.getPreferredSize(); label.setBounds(left, top, d.width, d.height); top += d.height + GUI_SMALL; fontField = new JTextField(FIELD_SIZE); pane.add(fontField); d = fontField.getPreferredSize(); fontField.setBounds(left, top, d.width, d.height); JButton button = new JButton("scan"); button.addActionListener( new ActionListener() { public void actionPerformed(ActionEvent e) { handleScanFonts(); } }); pane.add(button); Dimension d2 = button.getPreferredSize(); button.setBounds(left + d.width + GUI_SMALL, top, d2.width, d2.height); right = Math.max(right, left + d.width + GUI_SMALL + d2.width); top += d.height + GUI_BETWEEN; // GLOBAL_KEY_EVENTS globalKeyEventsBox = new JCheckBox("\"globalKeyEvents\": receive global key events"); pane.add(globalKeyEventsBox); d = globalKeyEventsBox.getPreferredSize(); globalKeyEventsBox.setBounds(left, top, d.width + 10, d.height); right = Math.max(right, left + d.width); top += d.height + GUI_BETWEEN; // PAUSE_ON_BLUR pauseOnBlurBox = new JCheckBox("\"pauseOnBlur\": pause if applet loses focus"); pane.add(pauseOnBlurBox); d = pauseOnBlurBox.getPreferredSize(); pauseOnBlurBox.setBounds(left, top, d.width + 10, d.height); right = Math.max(right, left + d.width); top += d.height + GUI_BETWEEN; // PRELOAD images label = new JLabel("\"preload\": images (comma separated)"); pane.add(label); d = label.getPreferredSize(); label.setBounds(left, top, d.width, d.height); top += d.height + GUI_SMALL; preloadField = new JTextField(FIELD_SIZE); pane.add(preloadField); d = preloadField.getPreferredSize(); preloadField.setBounds(left, top, d.width, d.height); button = new JButton("scan"); button.addActionListener( new ActionListener() { public void actionPerformed(ActionEvent e) { handleScanImages(); } }); pane.add(button); d2 = button.getPreferredSize(); button.setBounds(left + d.width + GUI_SMALL, top, d2.width, d2.height); right = Math.max(right, left + d.width + GUI_SMALL + d2.width); top += d.height + GUI_BETWEEN; // TRANSPARENT /*transparentBox = new JCheckBox("\"transparent\": set applet background to be transparent"); pane.add(transparentBox); d = transparentBox.getPreferredSize(); transparentBox.setBounds(left, top, d.width + 10, d.height); right = Math.max(right, left + d.width); top += d.height + GUI_BETWEEN;*/ // APPLY / OK button = new JButton("OK"); button.addActionListener( new ActionListener() { public void actionPerformed(ActionEvent e) { applyDirectives(); hide(); } }); pane.add(button); d2 = button.getPreferredSize(); int BUTTON_HEIGHT = d2.height; int BUTTON_WIDTH = 80; int h = right - (BUTTON_WIDTH + GUI_SMALL + BUTTON_WIDTH); button.setBounds(h, top, BUTTON_WIDTH, BUTTON_HEIGHT); h += BUTTON_WIDTH + GUI_SMALL; button = new JButton("Cancel"); button.addActionListener( new ActionListener() { public void actionPerformed(ActionEvent e) { hide(); } }); pane.add(button); button.setBounds(h, top, BUTTON_WIDTH, BUTTON_HEIGHT); top += BUTTON_HEIGHT + GUI_BETWEEN; // frame.getContentPane().add(box); frame.pack(); Insets insets = frame.getInsets(); frame.setSize( right + GUI_BIG + insets.left + insets.right, top + GUI_SMALL + insets.top + insets.bottom); // frame.setResizable(false); frame.setDefaultCloseOperation(WindowConstants.DO_NOTHING_ON_CLOSE); frame.addWindowListener( new WindowAdapter() { public void windowClosing(WindowEvent e) { frame.setVisible(false); } }); Toolkit.registerWindowCloseKeys( frame.getRootPane(), new ActionListener() { public void actionPerformed(ActionEvent actionEvent) { frame.setVisible(false); } }); Toolkit.setIcon(frame); }
void jbInit() throws Exception { panel1.setLayout(borderLayout1); jPanel1.setBorder(BorderFactory.createEtchedBorder()); jPanel1.setPreferredSize(new Dimension(14, 100)); jPanel1.setLayout(borderLayout2); jPanel2.setBorder(BorderFactory.createEtchedBorder()); jPanel2.setPreferredSize(new Dimension(10, 40)); jPanel2.setLayout(gridBagLayout1); jLabel2.setText("Oznaka banke:"); bPronadji.setPreferredSize(new java.awt.Dimension(80, 27)); bPronadji.setText("Pronadji "); bPronadji.addActionListener( new java.awt.event.ActionListener() { public void actionPerformed(ActionEvent e) { bPronadji_actionPerformed(e); } }); bIzlaz.setPreferredSize(new Dimension(80, 27)); bIzlaz.setText("Izlaz"); bIzlaz.addActionListener( new java.awt.event.ActionListener() { public void actionPerformed(ActionEvent e) { bIzlaz_actionPerformed(e); } }); txtOznakaBanke.setPreferredSize(new Dimension(120, 21)); getContentPane().add(panel1); panel1.add(jPanel1, BorderLayout.NORTH); { jLabel1 = new JLabel(); jPanel1.add(jLabel1, BorderLayout.CENTER); jLabel1.setText("PREGLED FILIJALA BANKE"); jLabel1.setFont(new java.awt.Font("Times New Roman", 1, 18)); jLabel1.setPreferredSize(new java.awt.Dimension(588, 96)); jLabel1.setHorizontalTextPosition(SwingConstants.CENTER); jLabel1.setHorizontalAlignment(SwingConstants.CENTER); jLabel1.setVerticalAlignment(SwingConstants.TOP); { jLabel3 = new JLabel(); jLabel1.add(jLabel3); jLabel3.setText("NAZIV:"); jLabel3.setBounds(7, 49, 42, 28); jLabel3.setFont(new java.awt.Font("Times New Roman", 1, 12)); } { jLabel4 = new JLabel(); jLabel1.add(jLabel4); jLabel4.setText("ADRESA:"); jLabel4.setBounds(280, 49, 63, 28); jLabel4.setFont(new java.awt.Font("Times New Roman", 1, 12)); } { jLnazivBanke = new JLabel(); jLabel1.add(jLnazivBanke); jLnazivBanke.setBounds(56, 49, 203, 28); } { jLadresaBanke = new JLabel(); jLabel1.add(jLadresaBanke); jLadresaBanke.setBounds(336, 49, 238, 28); } } panel1.add(jPanel2, BorderLayout.SOUTH); jPanel2.add( jLabel2, new GridBagConstraints( 0, 0, 1, 1, 0.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.NONE, new Insets(0, 0, 0, 0), 0, 0)); jPanel2.add( txtOznakaBanke, new GridBagConstraints( 1, 0, 1, 1, 0.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(0, 10, 0, 0), 0, 0)); jPanel2.add( bPronadji, new GridBagConstraints( 5, 0, 1, 1, 0.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.NONE, new Insets(0, 10, 0, 0), 0, 0)); jPanel2.add( bIzlaz, new GridBagConstraints( 5, 0, 1, 1, 0.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.NONE, new Insets(0, 200, 0, 0), 0, 0)); panel1.add(jScrollPane1, BorderLayout.CENTER); jScrollPane1.getViewport().add(tabBanke, null); TModelPrijave tMP = new TModelPrijave(tabBanke); tabBanke.setModel(tMP); ((TModelPrijave) tabBanke.getModel()).initColumns(); }
public CFFreeSwitchSwingPbxIvrMenuAttrJPanel( ICFFreeSwitchSwingSchema argSchema, ICFFreeSwitchPbxIvrMenuObj argFocus) { super(); JLabel label; JComponent compo; CFJReferenceEditor reference; final String S_ProcName = "construct-schema-focus"; if (argSchema == null) { throw CFLib.getDefaultExceptionFactory() .newNullArgumentException(getClass(), S_ProcName, 1, "argSchema"); } // argFocus is optional; focus may be set later during execution as // conditions of the runtime change. swingSchema = argSchema; setSwingFocusAsPbxIvrMenu(argFocus); final int spacing = 5; int y = spacing; final int height = 25; final int textheight = 80; final int vspacing = height + spacing; final int textvspacing = textheight + spacing; final int labelx = spacing; final int labelwidth = 200; final int fieldx = labelx + labelwidth + spacing; final int fieldwidth = 785; final int panelwidth = fieldx + fieldwidth + spacing; // temporary -- I think you have to have a panel bigger than the coordinates initially setSize(panelwidth, 100000); label = getSwingLabelContainerTenant(); add(label); label.setBounds(labelx, y, labelwidth, height); reference = getSwingReferenceContainerTenant(); add(reference); reference.setBounds(fieldx, y, fieldwidth, height); y = y + vspacing; label = getSwingLabelMenuId(); add(label); label.setBounds(labelx, y, labelwidth, height); compo = getSwingEditorMenuId(); add(compo); compo.setBounds(fieldx, y, fieldwidth, height); y = y + vspacing; label = getSwingLabelName(); add(label); label.setBounds(labelx, y, labelwidth, height); compo = getSwingEditorName(); add(compo); compo.setBounds(fieldx, y, fieldwidth, height); y = y + vspacing; label = getSwingLabelGreetLong(); add(label); label.setBounds(labelx, y, labelwidth, height); compo = getSwingEditorGreetLong(); add(compo); compo.setBounds(fieldx, y, fieldwidth, height); y = y + vspacing; label = getSwingLabelGreetShort(); add(label); label.setBounds(labelx, y, labelwidth, height); compo = getSwingEditorGreetShort(); add(compo); compo.setBounds(fieldx, y, fieldwidth, height); y = y + vspacing; label = getSwingLabelInvalidSound(); add(label); label.setBounds(labelx, y, labelwidth, height); compo = getSwingEditorInvalidSound(); add(compo); compo.setBounds(fieldx, y, fieldwidth, height); y = y + vspacing; label = getSwingLabelExitSound(); add(label); label.setBounds(labelx, y, labelwidth, height); compo = getSwingEditorExitSound(); add(compo); compo.setBounds(fieldx, y, fieldwidth, height); y = y + vspacing; label = getSwingLabelTimeout(); add(label); label.setBounds(labelx, y, labelwidth, height); compo = getSwingEditorTimeout(); add(compo); compo.setBounds(fieldx, y, fieldwidth, height); y = y + vspacing; label = getSwingLabelInterDigitTimeout(); add(label); label.setBounds(labelx, y, labelwidth, height); compo = getSwingEditorInterDigitTimeout(); add(compo); compo.setBounds(fieldx, y, fieldwidth, height); y = y + vspacing; label = getSwingLabelMaxFailures(); add(label); label.setBounds(labelx, y, labelwidth, height); compo = getSwingEditorMaxFailures(); add(compo); compo.setBounds(fieldx, y, fieldwidth, height); y = y + vspacing; label = getSwingLabelMaxTimeouts(); add(label); label.setBounds(labelx, y, labelwidth, height); compo = getSwingEditorMaxTimeouts(); add(compo); compo.setBounds(fieldx, y, fieldwidth, height); y = y + vspacing; label = getSwingLabelDigitLen(); add(label); label.setBounds(labelx, y, labelwidth, height); compo = getSwingEditorDigitLen(); add(compo); compo.setBounds(fieldx, y, fieldwidth, height); y = y + vspacing; // Now we can set the proper size based on the fields and references populated setSize(panelwidth, y); Dimension pfsz = new Dimension(panelwidth, y); setPreferredSize(pfsz); Dimension min = new Dimension(400, y); setMinimumSize(min); populateFields(); adjustComponentEnableStates(); swingIsInitializing = false; }
public Binary() { b1.addActionListener( new ActionListener() { public void actionPerformed(ActionEvent e) { firstValue = Double.parseDouble(t1.getText()); t9.setText((firstValue * secondValue) + "^1"); } }); b2.addActionListener( new ActionListener() { public void actionPerformed(ActionEvent e) { firstValue = Double.parseDouble(t2.getText()); t10.setText((firstValue * secondValue) + "^2"); } }); b3.addActionListener( new ActionListener() { public void actionPerformed(ActionEvent e) { firstValue = Double.parseDouble(t3.getText()); t11.setText((firstValue * secondValue) + "^3"); } }); b4.addActionListener( new ActionListener() { public void actionPerformed(ActionEvent e) { firstValue = Double.parseDouble(t4.getText()); t12.setText((firstValue * secondValue) + "^4"); } }); b5.addActionListener( new ActionListener() { public void actionPerformed(ActionEvent e) { firstValue = Double.parseDouble(t5.getText()); t13.setText((firstValue * secondValue) + "^5"); } }); b6.addActionListener( new ActionListener() { public void actionPerformed(ActionEvent e) { firstValue = Double.parseDouble(t6.getText()); t14.setText((firstValue * secondValue) + "^6"); } }); b7.addActionListener( new ActionListener() { public void actionPerformed(ActionEvent e) { firstValue = Double.parseDouble(t7.getText()); t15.setText((firstValue * secondValue) + "^7"); } }); b8.addActionListener( new ActionListener() { public void actionPerformed(ActionEvent e) { firstValue = Double.parseDouble(t8.getText()); t16.setText((firstValue * secondValue) + "^8"); } }); setLayout(null); add(b1); add(b2); add(b3); add(b4); add(b5); add(b6); add(b7); add(b8); add(l1); add(l2); add(l3); add(l4); add(l5); add(l6); add(l7); add(l8); add(l9); add(l10); add(l11); add(l12); add(l13); add(l14); add(l15); add(l16); add(l17); add(t1); add(t2); add(t3); add(t4); add(t5); add(t6); add(t7); add(t8); add(t9); add(t10); add(t11); add(t12); add(t13); add(t14); add(t15); add(t16); b1.setBounds(145, 27, 50, 20); b2.setBounds(145, 67, 50, 20); b3.setBounds(145, 107, 50, 20); b4.setBounds(145, 147, 50, 20); b5.setBounds(145, 187, 50, 20); b6.setBounds(145, 227, 50, 20); b7.setBounds(145, 267, 50, 20); b8.setBounds(145, 307, 50, 20); l17.setBounds(5, 5, 300, 20); // первая строка l1.setBounds(75, 27, 50, 20); l2.setBounds(75, 67, 50, 20); l3.setBounds(75, 107, 50, 20); l4.setBounds(75, 147, 50, 20); l5.setBounds(75, 187, 50, 20); l6.setBounds(75, 227, 50, 20); l7.setBounds(75, 267, 50, 20); l8.setBounds(75, 307, 50, 20); l9.setBounds(266, 27, 50, 20); l10.setBounds(266, 67, 50, 20); l11.setBounds(266, 107, 50, 20); l12.setBounds(266, 147, 50, 20); l13.setBounds(266, 187, 50, 20); l14.setBounds(266, 227, 50, 20); l15.setBounds(266, 267, 50, 20); l16.setBounds(266, 307, 50, 20); t1.setBounds(5, 27, 70, 20); t2.setBounds(5, 67, 70, 20); t3.setBounds(5, 107, 70, 20); t4.setBounds(5, 147, 70, 20); t5.setBounds(5, 187, 70, 20); t6.setBounds(5, 227, 70, 20); t7.setBounds(5, 267, 70, 20); t8.setBounds(5, 307, 70, 20); t9.setBounds(204, 27, 60, 20); t10.setBounds(204, 67, 60, 20); t11.setBounds(204, 107, 60, 20); t12.setBounds(204, 147, 60, 20); t13.setBounds(204, 187, 60, 20); t14.setBounds(204, 227, 60, 20); t15.setBounds(204, 267, 60, 20); t16.setBounds(204, 307, 60, 20); }
Usermaster() { Dimension dim = Toolkit.getDefaultToolkit().getScreenSize(); x = dim.width; y = dim.height; setSize(x, y); setUndecorated(true); Container c = getContentPane(); center = new JPanel() { public void paintComponent(Graphics g) { Toolkit kit = Toolkit.getDefaultToolkit(); Image img = kit.getImage("Image/user.jpg"); MediaTracker t = new MediaTracker(this); t.addImage(img, 0); while (true) { try { t.waitForAll(); break; } catch (Exception ee) { } } g.drawImage(img, 0, 0, x, y, null); } }; c.add(center); center.setLayout(null); titleLb = new JLabel( "<html><body ><font size='5'><b><i> User Name </b></i></font></body></html>"); titleLb.setForeground(new Color(10, 110, 255)); titleLb.setBounds(x / 2 + 50, x / 4, 150, 50); center.add(titleLb); output = new JLabel( "<html><body ><font size='5'><b><i> OUTPUT </b></i></font></body></html>"); output.setForeground(Color.white); output.setBounds(x / 2 - 250, x / 6, 150, 50); center.add(output); login = new JButton(new ImageIcon("Image/logBut.gif")); login.setBorder(BorderFactory.createRaisedBevelBorder()); login.setBounds(x / 2 + 100, x / 2 - 70, 100, 100); login.setBackground(Color.white); pass = new JPasswordField(); pass.setToolTipText("Enter The Password To Payroll System"); login.requestFocus(); pass.setBorder(BorderFactory.createRaisedBevelBorder()); pass.setForeground(new Color(10, 110, 255)); pass.setFont(new Font("Arial", Font.BOLD, 22)); pass.setCaretColor(Color.red); pass.setBounds(x / 2 + 50, x / 3, 200, 35); center.add(pass); center.add(login); pass.addKeyListener( new KeyAdapter() { public void keyPressed(KeyEvent e) { output.setText( "<html><body ><font size='5'><b><i> OUTPUT </b></i></font></body></html>"); output.setForeground(Color.white); } }); try { clsConnection connect = new clsConnection(); conn = connect.setConnection(conn, "", ""); } catch (Exception e) { } login.addActionListener( new ActionListener() { public void actionPerformed(ActionEvent e) { try { st = conn.createStatement(); rs = st.executeQuery("select * from img"); while (rs.next()) { if (pass.getText().equals(rs.getString(3))) { setVisible(false); URL url = closeSystem.class.getResource("spacemusic.au"); click = Applet.newAudioClip(url); click.play(); paro.setVisible(true); } else { pass.setText(""); pass.requestFocus(); output.setText("Fell"); output.setFont(new Font("Arial", Font.BOLD, 36)); output.setForeground(Color.red); } } } catch (Exception er) { System.out.println("Sorry\n" + er); } } }); }