public JPanel drawBoard(Piece[][] boardState) throws IOException { boardFrame.removeAll(); boardSquares = new JPanel[8][8]; for (int i = 0; i < boardSquares.length; i++) { for (int j = 0; j < boardSquares.length; j++) { JPanel square = new JPanel(); if ((j % 2 == 1 && i % 2 == 1) || (j % 2 == 0 && i % 2 == 0)) { square.setBackground(Color.WHITE); if (boardState[i][j] != null) { square.add(determinePiece(boardState[i][j])); } } else { square.setBackground(Color.gray); if (boardState[i][j] != null) { square.add(determinePiece(boardState[i][j])); } } boardFrame.add(square); } } return boardFrame; }
/** * Colors every unit depending on its owner. * * @param x the x * @param y the y */ private void colorSquareByOwner(int x, int y) { JPanel currentSquare = squares[x][y]; Entity currentEntity = matrix[x][y]; if (board.isFortress(x, y) || board.isMountainPass(x, y)) { if (board.getUnit(x, y) == null) { currentSquare.setBackground(COLOR_EMPTY); return; } else { currentEntity = board.getUnit(x, y); } } int owner = currentEntity.getOwner(); switch (owner) { case 0: if (!board.isArsenal(x, y) && (board.isFighter(x, y) && !((Fighter) currentEntity).isConnected())) currentSquare.setBackground(COLOR_PLAYER0); else currentSquare.setBackground(COLOR_COM_PLAYER0); break; case 1: if (!board.isArsenal(x, y) && (board.isFighter(x, y) && !((Fighter) currentEntity).isConnected())) currentSquare.setBackground(COLOR_PLAYER1); else currentSquare.setBackground(COLOR_COM_PLAYER1); break; } }
public void newframe() { JFrame frame = new JFrame("Cab Service "); frame.setSize(800, 600); frame.setVisible(true); // frame.setBackground(Color.CYAN); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); JButton jb = new JButton("Set Name of Places "); jb.setBounds(100, 100, 20, 50); JPanel jp = new JPanel(); jp.setBackground(Color.gray); jp.add(jb); frame.add(jp); JPanel jp1 = new JPanel(); jp1.setBackground(Color.gray); frame.add(jp1); frame.add(jp); jb.addActionListener( new ActionListener() { public void actionPerformed(ActionEvent e) { try { CreateFrame(); } catch (IOException ex) { Logger.getLogger(SetMap.class.getName()).log(Level.SEVERE, null, ex); } } }); }
public SwingTest() { Container contentPane = getContentPane(); pnTop.setBackground(Color.pink); pnCenter.setBackground(Color.YELLOW); pnBottom.setBackground(Color.BLUE); this.setLayout(new GridLayout(4, 1)); pnTop.add(lbName); pnTop.setLayout(new FlowLayout()); contentPane.add(pnTop); pnCenter.add(lbAge); contentPane.add(pnCenter); pnBottom.add(lbAddress); contentPane.add(pnBottom); pnResult.add(lbResult); contentPane.add(pnResult); Dimension screen = Toolkit.getDefaultToolkit().getScreenSize(); int nXpos = (int) (screen.getWidth() / 2 - super.getWidth() / 2); int nYpos = (int) (screen.getHeight() / 2 - super.getHeight() / 2); setSize(nXpos, nYpos); setVisible(true); }
private void initPlot() { m_plotPanel = new StripPlotter(); m_plotPanel.setBackground(Color.black); m_scalePanel.setBackground(Color.black); m_legendPanel.setBackground(Color.black); m_xCount = 0; }
public ShrinkItem() { super(); gridData = new GridBagConstraints(); gridData.weightx = 1.0; gridData.fill = GridBagConstraints.BOTH; gridData.gridwidth = GridBagConstraints.REMAINDER; jp.setLayout(gridBagLayout); container.setBackground(Color.RED); button.setText("0"); button.addActionListener( new ActionListener() { public void actionPerformed(ActionEvent e) { setCollapse(!bCollapse); } }); jp.setBackground(Color.BLACK); gridData.weighty = 0.0; gridBagLayout.setConstraints(button, gridData); jp.add(button); gridData.weighty = 1.0; gridData.fill = GridBagConstraints.BOTH; jp.add(container, gridData); }
@Override public void setBackground(Color bg) { super.setBackground(bg); if (canvas != null) { canvas.setBackground(bg); } }
private JComponent createConnectionConfigPanel(String environment) { JPanel panel = new JPanel(new GridBagLayout()); gbc = new GridBagConstraints( 0, 1, 1, 1, 2, 2, GridBagConstraints.CENTER, GridBagConstraints.HORIZONTAL, new Insets(2, 2, 2, 4), 1, 1); refreshContents(environment); for (int index = 0; index < _fields.length; index++) { // _fields[index].setEditable(false); _fields[index].setFont(MDFUtil.fontArialPlain12); _fields[index].setBackground(bgColorField); _fields[index].setForeground(Color.black); } int row = 0; addGridComponent(0, row, 4, 4, panel, createLabel("TCP Info : ")); addGridComponent(1, row, 8, 8, panel, textTcpAddress); addGridComponent(2, row, 4, 4, panel, createLabel("UserName : "******"Password : "******"Network Interface : ")); addGridComponent(1, row, 8, 8, panel, textMulticastNetworkInterface); addGridComponent(2, row, 4, 4, panel, createLabel("SeqProblem Action : ")); addGridComponent(3, row, 8, 8, panel, textSequenceProblemAction); addGridComponent(4, row, 4, 4, panel, createLabel("InactivityThreshold : ")); addGridComponent(5, row, 8, 8, panel, textMulticastInactivityThreshold); */ JPanel masterPanel = new JPanel(new BorderLayout()); masterPanel.add(panel, BorderLayout.CENTER); masterPanel.add(new JLabel(" "), BorderLayout.SOUTH); masterPanel.setBorder( new TitledBorder( BorderFactory.createLineBorder(Color.blue, 1), "TCP/Parameters", TitledBorder.LEADING, TitledBorder.TOP, new Font("Arial", Font.BOLD, 12))); panel.setBackground(bgColorPanel); masterPanel.setBackground(bgColorPanel); return (new JScrollPane(masterPanel)); }
/** * Tool for transferring annotation from one feature to other feature(s) * * @param feature * @param entryGroup * @param geneNames */ public TransferAnnotationTool( final Feature feature, final EntryGroup entryGroup, final MatchPanel matchPanel) { super("Transfer Annotation Tool :: " + feature.getIDString()); this.matchPanel = matchPanel; List<String> geneNames = null; if (matchPanel != null) geneNames = matchPanel.getGeneNameList(); JPanel panel = new JPanel(new FlowLayout(FlowLayout.LEFT)); JPanel pane = new JPanel(new GridBagLayout()); JScrollPane jsp = new JScrollPane(panel); panel.setBackground(Color.white); pane.setBackground(Color.white); panel.add(pane); JPanel framePanel = (JPanel) getContentPane(); framePanel.add(jsp, BorderLayout.CENTER); framePanel.setPreferredSize(new Dimension(600, 600)); final Vector<JCheckBox> geneNameCheckBoxes = new Vector<JCheckBox>(); final Vector<QualifierPanel> qualifierPanels = new Vector<QualifierPanel>(); addMainPanel(feature, pane, qualifierPanels, geneNameCheckBoxes, geneNames); addBottomButtons( qualifierPanels, geneNameCheckBoxes, framePanel, entryGroup); pack(); setVisible(true); }
private void init() { energyConsumptionStatsPanel = new JPanel(new GridLayout(17, 2, 5, 5)); energyStatisticsLeftAlligmentPanel = new JPanel(new BorderLayout()); energyConsumptionStatsPanel.setBackground(UIManager.getColor(AROUIManager.PAGE_BACKGROUND_KEY)); energyStatisticsLeftAlligmentPanel.setBackground( UIManager.getColor(AROUIManager.PAGE_BACKGROUND_KEY)); createRRCStatsPanel(); createPeripheralStatisticsPanel(); energyStatisticsPanel = new JPanel(); energyStatisticsPanel.setLayout(new VerticalLayout()); energyStatisticsPanel.setBackground(UIManager.getColor(AROUIManager.PAGE_BACKGROUND_KEY)); energyStatisticsHeaderLabel = new JLabel(rb.getString("energy.title")); energyStatisticsHeaderLabel.setFont(HEADER_FONT); energyStatisticsPanel.add(energyStatisticsHeaderLabel); spacePanel = new JPanel(); spacePanel.setPreferredSize(new Dimension(this.getWidth(), HEADER_DATA_SPACING)); spacePanel.setBackground(UIManager.getColor(AROUIManager.PAGE_BACKGROUND_KEY)); energyStatisticsPanel.add(spacePanel); energyStatisticsPanel.add(energyConsumptionStatsPanel); energyStatisticsLeftAlligmentPanel.add(energyStatisticsPanel, BorderLayout.WEST); }
public void initComponents() { login_center_panel.setLayout(new GridLayout(1, 2)); login_center_panel.setBackground(Constants.cl_blue); logout_passwort_label.setForeground(Color.WHITE); login_center_panel.add(logout_passwort_label); login_center_panel.add(logout_passwort_passwordfield); add(login_center_panel, BorderLayout.CENTER); /* BottomPanel */ login_bottom_panel.setBackground(Constants.cl_blue); logout_ok_button.addActionListener(this); logout_ok_button.addKeyListener(this); login_bottom_panel.add(logout_ok_button); logout_break_button.addActionListener(this); logout_break_button.addKeyListener(this); login_bottom_panel.add(logout_break_button); add(login_bottom_panel, BorderLayout.SOUTH); } // #initComponents
public void go() { picture(); ActionListener listener = new BtListener(); go.addActionListener(listener); btn_update_manual.addActionListener(listener); go.setForeground(Color.black); // rights.setFont((new Font("Arial", Font.PLAIN, 12))); title.setFont((new Font("Arial", Font.BOLD, 36))); title.setForeground(new Color(238, 253, 253)); today.setFont((new Font("Arial", Font.BOLD, 16))); today.setForeground(new Color(163, 184, 204)); frame.setLayout(new BorderLayout()); from.setBackground(Color.white); to.setBackground(Color.white); converted.setFont(new Font("Arial", Font.BOLD, 24)); converted.setForeground(new Color(238, 253, 253)); Lfrom.setForeground(new Color(238, 253, 253)); Lto.setForeground(new Color(238, 253, 253)); quantity.setForeground(new Color(238, 253, 253)); Lfrom.setFont(new Font("Arial", Font.BOLD, 24)); Lto.setFont(new Font("Arial", Font.BOLD, 24)); quantity.setFont(new Font("Arial", Font.BOLD, 24)); north.setLayout(new FlowLayout()); north.add(title); north.setBackground(new Color(59, 62, 71)); frame.add(BorderLayout.NORTH, north); inner.setLayout(new BorderLayout()); inner.add(BorderLayout.NORTH, today); inner.add(BorderLayout.WEST, picPanel); center.setLayout(new GridLayout(2, 4, 5, 5)); center.add(Lfrom); center.add(from); center.add(Lto); center.add(to); center.add(quantity); center.add(amount); center.add(go); inner.setBackground(new Color(59, 62, 71)); inner.add(BorderLayout.SOUTH, center); center.setBackground(new Color(59, 62, 71)); frame.add(BorderLayout.CENTER, inner); south.setBackground(new Color(59, 62, 71)); south.setLayout(new FlowLayout()); south.add(converted); south.add(answer); south.add(btn_update_manual); // south.add(rights); frame.add(BorderLayout.SOUTH, south); frame.setSize(850, 700); frame.setVisible(true); frame.addWindowListener( new WindowAdapter() { public void windowClosing(WindowEvent event) { frame.setVisible(false); frame.dispose(); System.exit(0); } }); }
public TransactionPanel() { setLayout(new GridLayout(2, 1)); setBorder(BorderFactory.createMatteBorder(10, 10, 10, 10, DARK_CHAMPAGNE)); listModel.removeAllElements(); readTransactions(); receiptList.setSelectionMode(ListSelectionModel.SINGLE_SELECTION); titleLabel.setVerticalAlignment(SwingConstants.TOP); titleLabel.setFont(new Font(Font.SERIF, Font.BOLD, 24)); listLabel.setVerticalAlignment(SwingConstants.BOTTOM); listLabel.setFont(new Font(Font.SERIF, Font.ITALIC, 18)); buttonPanel.setBackground(DARK_CHAMPAGNE); buttonPanel.add(new MenuButton("Load", "Load", this)); // buttonPanel.add(new MenuButton("Delete","Delete",this)); // buttonPanel.add(new MenuButton("Void", "Void", this)); // buttonPanel.add(new MenuButton("Delete All","Delete All",this)); buttonPanel.add(new MenuButton("Print", "Print", this)); Tools.addBlankSpace(buttonPanel, 2); upperPanel.setBackground(DARK_CHAMPAGNE); upperPanel.add(titleLabel); upperPanel.add(buttonPanel); upperPanel.add(listLabel); add(upperPanel); add( new JScrollPane( receiptList, ScrollPaneConstants.VERTICAL_SCROLLBAR_ALWAYS, ScrollPaneConstants.HORIZONTAL_SCROLLBAR_ALWAYS)); }
private static JPanel createJContentPane(JLabel statusLabel, JTable table) { // this is the main JPanel JPanel jContentPane = new JPanel(); jContentPane.setBackground(Color.white); jContentPane.setLayout(new BoxLayout(jContentPane, BoxLayout.Y_AXIS)); // we create a JPanel containing the status indicator, our logo and the demo name // we'll use this JPanel as first element on the main JPanel JPanel firstLine = new JPanel(); firstLine.setBackground(Color.white); firstLine.setLayout(new BoxLayout(firstLine, BoxLayout.X_AXIS)); firstLine.add(statusLabel); JLabel label = new JLabel(TITLE, LOGO, JLabel.LEFT); firstLine.add(label); firstLine.add(Box.createHorizontalGlue()); // then we add the previously created first-line-JPanel and the JTable to // the main JPanel jContentPane.add(firstLine); // (we wrap the JTable in a JSCrollPane so that we have scrollbars) JScrollPane scrollPane = new JScrollPane(table); jContentPane.add(scrollPane); return jContentPane; }
public ReceiveAddressDialog(JDialog parent) { super(parent, "Receive Addresses", Dialog.ModalityType.DOCUMENT_MODAL); setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE); tableModel = new AddressTableModel(columnNames, columnClasses); table = new AddressTable(tableModel, columnTypes); table.setRowSorter(new TableRowSorter<>(tableModel)); table.setSelectionMode(ListSelectionModel.SINGLE_SELECTION); scrollPane = new JScrollPane(table); JPanel tablePane = new JPanel(); tablePane.setBackground(Color.WHITE); tablePane.add(Box.createGlue()); tablePane.add(scrollPane); tablePane.add(Box.createGlue()); JPanel buttonPane = new ButtonPane( this, 10, new String[] {"New", "new"}, new String[] {"Copy", "copy"}, new String[] {"Edit", "edit"}, new String[] {"Done", "done"}); buttonPane.setBackground(Color.white); JPanel contentPane = new JPanel(); contentPane.setLayout(new BoxLayout(contentPane, BoxLayout.Y_AXIS)); contentPane.setOpaque(true); contentPane.setBorder(BorderFactory.createEmptyBorder(15, 15, 15, 15)); contentPane.setBackground(Color.WHITE); contentPane.add(tablePane); contentPane.add(buttonPane); setContentPane(contentPane); }
public test() { panelCont.setLayout(cl); panelFirst.add(buttonOne); panelSecond.add(buttonSecond); panelFirst.setBackground(Color.BLUE); panelSecond.setBackground(Color.GREEN); panelCont.add(panelFirst, "1"); panelCont.add(panelSecond, "2"); cl.show(panelCont, "1"); buttonOne.addActionListener( new ActionListener() { @Override public void actionPerformed(ActionEvent arg0) { cl.show(panelCont, "2"); } }); buttonSecond.addActionListener( new ActionListener() { @Override public void actionPerformed(ActionEvent arg0) { cl.show(panelCont, "1"); } }); frame.add(panelCont); frame.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE); frame.pack(); frame.setVisible(true); }
private JPanel createVerticalButtonBar() { JPanel buttonPanel = new JPanel(new BorderLayout()); buttonPanel.setBackground(SIDEBAR_COLOR); buttonPanel.setBorder(BorderFactory.createMatteBorder(0, 0, 0, 1, new Color(0x333333))); buttonBar = new JPanel(); buttonBar.setBorder(BorderFactory.createMatteBorder(1, 0, 0, 0, new Color(0x333333))); buttonBar.setLayout(new BoxLayout(buttonBar, BoxLayout.Y_AXIS)); buttonBar.setBackground(SIDEBAR_COLOR); buttonBar.setMaximumSize(new Dimension(BUTTON_WIDTH, 1000)); buttonBar.setMinimumSize(new Dimension(BUTTON_WIDTH, 100)); // --- buttonGroup = new ButtonGroup(); fontsButton = createButton("Fonts", Resources.loadIcon("main/fonts.png")); imagesButton = createButton("Images", Resources.loadIcon("main/images.png")); buttonBar.add(fontsButton); buttonBar.add(imagesButton); buttonPanel.add(buttonBar, BorderLayout.NORTH); buttonPanel.add(StatusBar.createStatusBar(), BorderLayout.SOUTH); return buttonPanel; }
@Override public Component getListCellRendererComponent( JList list, Object value, int index, boolean isSelected, boolean cellHasFocus) { if (list instanceof CheckList) { // calculate the max width of the logo int maxWidth = 0; for (int i = 0; i < list.getModel().getSize(); i++) { Object obj = list.getModel().getElementAt(i); if (obj instanceof MediaScraper) { MediaScraper ms = (MediaScraper) obj; ImageIcon logo = getIcon(ms.getLogoURL()); maxWidth = Math.max(maxWidth, logo.getIconWidth()); } } CheckList cbl = (CheckList) list; ListCheckModel model = cbl.getModel(); boolean checked = model.isChecked(value); boolean locked = model.isLocked(value); setSelected(checked); if (locked || cbl.isEnabled() == false) { setEnabled(false); } else { setEnabled(true); } if (getHighlight().equals(Highlight.MOUSE_OVER_AND_CHECKED_ITEMS) && (checked || isSelected)) { panel.setBackground(selectionBackground); panel.setForeground(selectionForeground); } else if (getHighlight().equals(Highlight.MOUSE_OVER) && isSelected) { panel.setBackground(selectionBackground); panel.setForeground(selectionForeground); } else if (getHighlight().equals(Highlight.CHECKED_ITEMS) && checked) { panel.setBackground(selectionBackground); panel.setForeground(selectionForeground); } else { panel.setBackground(background); panel.setForeground(foreground); } if (value instanceof MediaScraper) { MediaScraper scraper = (MediaScraper) value; int currentWidth = 0; ImageIcon logo = getIcon(scraper.getLogoURL()); if (logo != null) { currentWidth = logo.getIconWidth(); } label.setIcon(logo); label.setIconTextGap(maxWidth + 4 - currentWidth); // 4 = default iconTextGap } else { label.setIcon(null); label.setIconTextGap(4); // 4 = default iconTextGap } } label.setText(getText(value)); return panel; }
/** * Constructor * * @param aFrame */ public RenameWindow(Frame aFrame) { super(aFrame, true); setTitle2("Enter a new name"); setTitle("Rename"); setBounds(100, 100, 416, 275); final JPanel centerPanel = new JPanel(); centerPanel.setBackground(Color.WHITE); final GridBagLayout gridBagLayout = new GridBagLayout(); gridBagLayout.rowHeights = new int[] {0, 7, 7}; centerPanel.setLayout(gridBagLayout); getContentPane().add(centerPanel, BorderLayout.CENTER); newName_ = new JTextField(); newName_.setRequestFocusEnabled(false); newName_.setColumns(26); final GridBagConstraints gridBagConstraints = new GridBagConstraints(); gridBagConstraints.gridy = 0; gridBagConstraints.gridx = 0; centerPanel.add(newName_, gridBagConstraints); setLocationRelativeTo(aFrame); final Component component = Box.createVerticalStrut(5); final GridBagConstraints gridBagConstraints_2 = new GridBagConstraints(); gridBagConstraints_2.gridy = 1; gridBagConstraints_2.gridx = 0; centerPanel.add(component, gridBagConstraints_2); final JPanel actionPanel = new JPanel(); actionPanel.setBackground(Color.WHITE); final FlowLayout flowLayout_1 = new FlowLayout(); actionPanel.setLayout(flowLayout_1); final GridBagConstraints gridBagConstraints_1 = new GridBagConstraints(); gridBagConstraints_1.gridy = 2; gridBagConstraints_1.gridx = 0; centerPanel.add(actionPanel, gridBagConstraints_1); applyButton = new JButton(); applyButton.setMnemonic(KeyEvent.VK_A); applyButton.setSelected(true); applyButton.setFont(new Font("Sans", Font.PLAIN, 12)); applyButton.setText("Apply"); actionPanel.add(applyButton); final Component component_1 = Box.createHorizontalStrut(2); actionPanel.add(component_1); cancelButton = new JButton(); cancelButton.setMnemonic(KeyEvent.VK_C); cancelButton.setFont(new Font("Sans", Font.PLAIN, 12)); cancelButton.setText("Cancel"); actionPanel.add(cancelButton); // GnwGuiSettings settings = GnwGuiSettings.getInstance(); // applyButton.setIcon(new ImageIcon(settings.getApplyIconPath())); // cancelButton.setIcon(new ImageIcon(settings.getCancelIconPath())); }
public void setBackground(Color color) { super.setBackground(color); if (logo != null) logo.setBackground(color); if (center != null) center.setBackground(color); // if(bottom != null) // bottom.setBackground(color); if (marketSharePanel != null) marketSharePanel.setBackground(color); }
// Constructor public DeleteArchiveFrame(AmazonGlacierClient client, String vaultName, int region) { super("Delete Archive"); int width = 200; int height = 170; Color wc = Color.WHITE; deleteClient = client; deleteVault = vaultName; JLabel label1 = new JLabel("ArchiveID to Delete from " + Endpoint.getTitleByIndex(region) + ":"); jtfDeleteField = new JTextField(100); jbtDelete = new JButton("Delete"); jbtBack = new JButton("Back"); JPanel p1 = new JPanel(); p1.setLayout(new FlowLayout()); p1.add(label1); p1.setBackground(wc); JPanel p2 = new JPanel(); p2.setLayout(new FlowLayout()); p2.add(jtfDeleteField); jtfDeleteField.addMouseListener(new ContextMenuMouseListener()); jtfDeleteField.setFocusable(true); p2.setBackground(wc); JPanel p3 = new JPanel(); p3.setLayout(new FlowLayout()); p3.add(jbtDelete); jbtDelete.addActionListener(this); jbtDelete.setBackground(wc); p3.add(jbtBack); jbtBack.addActionListener(this); jbtBack.setBackground(wc); p3.setBackground(wc); JPanel p4 = new JPanel(); p4.setLayout(new BorderLayout()); p4.setBackground(wc); p4.add(p1, BorderLayout.NORTH); p4.add(p2, BorderLayout.CENTER); p4.add(p3, BorderLayout.SOUTH); setContentPane(p4); // Prepare for display pack(); if (width < getWidth()) // prevent setting width too small width = getWidth(); if (height < getHeight()) // prevent setting height too small height = getHeight(); centerOnScreen(width, height); jtfDeleteField.setText(""); jtfDeleteField.requestFocus(); }
private void handleClientRequest(StringMessage request) { if (!checkAgentAddress(request.getSender())) // Is the client still there ? return; if (hasGUI()) { // starting the contract net blinkPanel.setBackground(Color.YELLOW); } if (logger != null) logger.info( "I received a request for a " + request.getContent() + " \nfrom " + request.getSender()); List<Message> bids = broadcastMessageWithRoleAndWaitForReplies( // wait all answers MarketOrganization.COMMUNITY, // community MarketOrganization.PROVIDERS_GROUP, // group request.getContent() + "-" + MarketOrganization.PROVIDER_ROLE, // role new StringMessage("make-bid-please"), // ask for a bid MarketOrganization.BROKER_ROLE, // I am a broker 900); // I cannot wait the end of the universe if (bids == null) { // no reply if (logger != null) logger.info( "No bids at all : No one is selling " + request.getContent().toUpperCase() + " !!\nPlease launch other providers !a"); if (hasGUI()) { blinkPanel.setBackground(Color.LIGHT_GRAY); } return; } // select the best offer final List<IntegerMessage> offers = Arrays.asList(bids.toArray(new IntegerMessage[0])); // casting IntegerMessage best = ObjectMessage.min(offers); if (logger != null) logger.info("The best offer is from " + best.getSender() + " " + best.getContent()); // creating a contract group String contractGroupId = "" + System.nanoTime(); // sending the location to the provider Message ack = sendMessageWithRoleAndWaitForReply( best.getSender(), // the address of the provider new StringMessage(contractGroupId), // send group's info MarketOrganization.BROKER_ROLE, // I am a broker 1000); // I cannot wait the end of the universe if (ack != null) { // The provider has entered the contract group if (logger != null) logger.info("Provider is ready !\nSending the contract number to client"); sendReply(request, new StringMessage(contractGroupId)); // send group's info pause((int) (Math.random() * 2000 + 1000)); // let us celebrate !! } else { // no answer from the provider... if (logger != null) logger.info("Provider disappears !!!!"); } if (hasGUI()) { blinkPanel.setBackground(Color.LIGHT_GRAY); } }
private void generateContainers() { contentPane = new JPanel(); contentPane.setBorder(new EmptyBorder(5, 5, 5, 5)); setContentPane(contentPane); rightPanel = new JPanel(); rightPanel.setBackground(Color.WHITE); leftPanel = new JPanel(); leftPanel.setBackground(Color.WHITE); }
/** * Overridden to make sure that all the components have the correct background. * * @see JPanel#setBackground(Color) */ public void setBackground(Color color) { if (busyLabel != null) busyLabel.setBackground(color); if (namePane != null) { namePane.setBackground(color); for (int i = 0; i < namePane.getComponentCount(); i++) namePane.getComponent(i).setBackground(color); } super.setBackground(color); }
public void generateMagnifiedTileBar(ArrayList<Integer> selectedChapters) { hasBeenMagnified = true; this.removeAll(); tileBar.removeAll(); int accumulator = 0; for (int i = 0; i < selectedChapters.size(); i++) { chapterTiles.get(selectedChapters.get(i)).magnifyTileBar(magnification); chapterTiles .get(selectedChapters.get(i)) .setBounds( moveX + (offSetBetweenTiles * i + accumulator) * magnification, moveY, ((selected.getChapter(selectedChapters.get(i)).getEnd() - selected.getChapter(selectedChapters.get(i)).getStart()) + 1) * magnification, 52); ArrayList<Chapter> subChapters = chapterTiles.get(selectedChapters.get(i)).getChapter().getSubChapters(); for (Chapter c : subChapters) { // Add the two ticks(top/bottom) JPanel topMarker = new JPanel(); topMarker.setBackground(Color.GRAY); topMarker.setBounds( new Rectangle( (moveX + (c.getStart() - chapterTiles.get(selectedChapters.get(i)).getChapter().getStart() + offSetBetweenTiles * i + accumulator) * magnification), moveY - markerLength, 1, markerLength)); this.add(topMarker); JPanel bottomMarker = new JPanel(); bottomMarker.setBackground(Color.GRAY); bottomMarker.setBounds( (moveX + (c.getStart() - chapterTiles.get(selectedChapters.get(i)).getChapter().getStart() + offSetBetweenTiles * i + accumulator) * magnification), 52 + moveY, 1, markerLength); this.add(bottomMarker); } accumulator += selected.getChapter(selectedChapters.get(i)).getEnd() - selected.getChapter(selectedChapters.get(i)).getStart() + 1; tileBar.add(chapterTiles.get(selectedChapters.get(i))); this.add(chapterTiles.get(selectedChapters.get(i))); } }
private void currentUser() { if (carrera.getCorredorActivo() instanceof Liebre) { jPanel_Liebre.setBorder(null); jPanel_Liebre.setBackground(Color.BLACK); } else if (carrera.getCorredorActivo() instanceof Tortuga) { jPanelTortuga.setBorder(null); jPanel_Liebre.setBackground(Color.BLACK); } }
private void setValidated(boolean valid) { if (valid) { buttonPanel.setBackground(ClientColor.vectorTitles); setBorder(vp.wp.eWrapperBorder); } else { buttonPanel.setBackground(ClientColor.vectorTitlesInvalid); setBorder(vp.wp.eWrapperBorderInvalid); } }
public TeacherManagePasswords() { super(new BorderLayout()); setBackground(FWCConfigurator.bgColor); // Build title and north panel pnNorth = new JPanel(new FlowLayout(FlowLayout.CENTER)); pnNorth.setBackground(FWCConfigurator.bgColor); lblTitle = new TitleLabel("Reset Passwords", FWCConfigurator.RESET_PASSW_TITLE_IMG); pnNorth.add(lblTitle); // Build center panel pnCenter = new JPanel(new BorderLayout()); pnCenter.setBackground(FWCConfigurator.bgColor); // Build table of students tableModel = new DisabledTableModel(); tableModel.setColumnIdentifiers( new String[] {"First Name", " Last " + "Name", "Username", "Class"}); studentsTable = new JTable(tableModel); studentsTable.setAutoResizeMode(JTable.AUTO_RESIZE_ALL_COLUMNS); studentsTable.setFillsViewportHeight(true); studentsTable.getTableHeader().setFont(new Font("Calibri", Font.PLAIN, 18)); studentsTable.setFont(new Font("Calibri", Font.PLAIN, 18)); studentsTable.setRowHeight(studentsTable.getRowHeight() + 12); // Populate the table only with students that need a password reset students = FWCConfigurator.getTeacher().getStudentsRequestedReset(); populateTable(); tableScroll = new JScrollPane( studentsTable, JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED, JScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED); tableScroll.setBackground(FWCConfigurator.bgColor); tableScroll.setBorder( BorderFactory.createCompoundBorder( new EmptyBorder(10, 100, 10, 100), new LineBorder(Color.black, 1))); pnCenter.add(tableScroll, BorderLayout.CENTER); // Build south panel pnButtons = new JPanel(new FlowLayout(FlowLayout.CENTER)); pnButtons.setBackground(FWCConfigurator.bgColor); pnButtons.setBorder(BorderFactory.createEmptyBorder(0, 100, 20, 100)); btnReset = new ImageButton("Reset Selected", FWCConfigurator.RESET_SELECTED_IMG, 150, 50); btnReset.addActionListener(new ResetListener()); btnResetAll = new ImageButton("Reset All", FWCConfigurator.RESET_ALL_IMG, 150, 50); btnResetAll.addActionListener(new ResetListener()); pnButtons.add(btnReset); pnButtons.add(btnResetAll); this.add(pnNorth, BorderLayout.NORTH); this.add(pnCenter, BorderLayout.CENTER); this.add(pnButtons, BorderLayout.SOUTH); }
public void setBackground(Color c) { super.setBackground(c); if (questionBody != null) questionBody.setBackground(c); if (buttonPanel != null) buttonPanel.setBackground(c); if (choicePanel != null) choicePanel.setBackground(c); if (choices != null) { for (AbstractButton ab : choices) ab.setBackground(c); } }
public JFrameComandi(Mediator mediator) { panelText = new JPanel(); panelText.setLayout(new BorderLayout()); panelText.setBackground(Color.white); panelButton = new JPanel(); panelButton.setBackground(Color.white); dimensione = Toolkit.getDefaultToolkit().getScreenSize(); setTitle("Comandi"); txa = new JTextArea(); txa.setEditable(false); txa.setText(text); txa.setFont(new Font("Ariel", Font.PLAIN, dimensione.height / 55)); txa.setLineWrap(true); txa.setWrapStyleWord(true); ok = new JButton("ESCI"); ok.setName("okComandi"); ok.setFont(new Font("Ariel", Font.PLAIN, dimensione.height / 50)); panelText.add(txa, BorderLayout.CENTER); panelButton.add(ok, BorderLayout.CENTER); mediator.manageEvent(new ActionEvent(ok, Counter.generateID(), null)); pack(); setResizable(false); setSize(new Dimension(dimensione.width / 3, dimensione.height / 3)); add(panelText, BorderLayout.CENTER); add(panelButton, BorderLayout.SOUTH); setAlwaysOnTop(true); setLocationRelativeTo(null); setVisible(false); setDefaultCloseOperation(DISPOSE_ON_CLOSE); }