List of usage examples for java.awt Font getFontName
public String getFontName()
From source file:com.petersoft.advancedswing.enhancedtextarea.EnhancedTextArea.java
private void jFontSmallerButtonActionPerformed(ActionEvent evt) { Font f = jTextArea.getFont(); Font newFont = new Font(f.getFontName(), f.getStyle(), f.getSize() - 1); jTextArea.setFont(newFont);//from w w w . ja v a 2 s .com lines.setFont(newFont); }
From source file:com.petersoft.advancedswing.enhancedtextarea.EnhancedTextArea.java
private void jFontBiggerButtonActionPerformed(ActionEvent evt) { Font f = jTextArea.getFont(); Font newFont = new Font(f.getFontName(), f.getStyle(), f.getSize() + 1); jTextArea.setFont(newFont);/* w ww. j av a 2s . c o m*/ lines.setFont(newFont); }
From source file:ca.sqlpower.architect.swingui.TestPlayPenComponent.java
/** * Returns a new value that is not equal to oldVal. The * returned object will be a new instance compatible with oldVal. * /* ww w . j a v a2s . c o m*/ * @param property The property that should be modified. * @param oldVal The existing value of the property to modify. The returned value * will not equal this one at the time this method was first called. */ private Object getNewDifferentValue(PropertyDescriptor property, Object oldVal) throws SQLObjectException { Object newVal; // don't init here so compiler can warn if the // following code doesn't always give it a value if (property.getPropertyType() == String.class) { newVal = "new " + oldVal; } else if (property.getPropertyType() == Boolean.class || property.getPropertyType() == Boolean.TYPE) { if (oldVal == null) { newVal = new Boolean(false); } else { newVal = new Boolean(!((Boolean) oldVal).booleanValue()); } } else if (property.getPropertyType() == Integer.class || property.getPropertyType() == Integer.TYPE) { if (oldVal == null) { newVal = new Integer(0); } else { newVal = new Integer(((Integer) oldVal).intValue() + 1); } } else if (property.getPropertyType() == Double.class || property.getPropertyType() == Double.TYPE) { if (oldVal == null) { newVal = new Double(0); } else { newVal = new Double(((Double) oldVal).doubleValue() + 1); } } else if (property.getPropertyType() == Color.class) { if (oldVal == null) { newVal = new Color(0xFAC157); } else { Color oldColor = (Color) oldVal; newVal = new Color((oldColor.getRGB() + 0xF00) % 0x1000000); } } else if (property.getPropertyType() == Font.class) { if (oldVal == null) { newVal = FontManager.getDefaultPhysicalFont(); } else { Font oldFont = (Font) oldVal; newVal = new Font(oldFont.getFontName(), oldFont.getSize() + 2, oldFont.getStyle()); } } else if (property.getPropertyType() == Point.class) { if (oldVal == null) { newVal = new Point(); } else { Point oldPoint = (Point) oldVal; newVal = new Point(oldPoint.x + 10, oldPoint.y + 10); } } else if (property.getPropertyType() == Insets.class) { if (oldVal == null) { newVal = new Insets(0, 0, 0, 0); } else { Insets oldInsets = (Insets) oldVal; newVal = new Insets(oldInsets.top + 10, oldInsets.left + 10, oldInsets.bottom + 10, oldInsets.right + 10); } } else if (property.getPropertyType() == Set.class) { newVal = new HashSet(); if (property.getName().equals("hiddenColumns")) { ((Set) newVal).add(new SQLColumn()); } else { ((Set) newVal).add("Test"); } } else if (property.getPropertyType() == List.class) { newVal = new ArrayList(); if (property.getName().equals("selectedColumns")) { ((List) newVal).add(new SQLColumn()); } else { ((List) newVal).add("Test"); } } else if (property.getPropertyType() == TablePane.class) { SQLTable t = new SQLTable(); t.initFolders(true); newVal = new TablePane(t, pp.getContentPane()); } else if (property.getPropertyType() == SQLTable.class) { newVal = new SQLTable(); ((SQLTable) newVal).initFolders(true); } else if (property.getPropertyType() == Dimension.class) { newVal = new Dimension(); if (oldVal != null) { ((Dimension) newVal).width = ((Dimension) oldVal).width + 1; } } else { throw new RuntimeException("This test case lacks a value for " + property.getName() + " (type " + property.getPropertyType().getName() + ") in getNewDifferentValue()"); } return newVal; }
From source file:TrabajoFinalJava.FormularioVerFicheros.java
public void run() { //************************INICIO****INTERFAZ************************************************************************** JFrame principal = new JFrame("GESTOR DESCARGAS"); //Colores//from w w w .j av a2s . c o m Color nuevoColor = new Color(167, 220, 231); principal.getContentPane().setBackground(nuevoColor); JLabel tituloPrincipal = new JLabel("GESTOR DESCARGAS"); JLabel tituloVentana = new JLabel("VER FICHEROS"); JTextArea cajaFicheros = new JTextArea(12, 20); JButton mostrar = new JButton("MOSTRAR FICHEROS"); JButton atras = new JButton("ATRAS"); JButton salir = new JButton("SALIR"); cajaFicheros.setEditable(false); //Recojo la fuente que se esta utilizando actualmente. Font auxFont = tituloPrincipal.getFont(); //Aplico la fuente actual, y al final le doy el tamao del texto... tituloPrincipal.setFont(new Font(auxFont.getFontName(), auxFont.getStyle(), 30)); tituloVentana.setFont(new Font(auxFont.getFontName(), auxFont.getStyle(), 30)); GridBagLayout gridbag = new GridBagLayout(); GridBagConstraints gbc = new GridBagConstraints(); //Asignamos la constante EXIT_ON_CLOSE, cierra la ventana al pulsar la X. principal.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); //Asignamos al JFrame el Layout que usaremos, GridBagLayout principal.setLayout(gridbag); //aadir botones al layout gbc.gridx = 1; gbc.gridy = 0; gbc.gridwidth = 1; gbc.gridheight = 1; gbc.weighty = 0.1; gbc.fill = GridBagConstraints.HORIZONTAL; principal.add(tituloPrincipal, gbc); gbc.gridx = 1; gbc.gridy = 1; gbc.gridwidth = 1; gbc.gridheight = 1; gbc.weighty = 0.1; gbc.fill = GridBagConstraints.NONE; principal.add(tituloVentana, gbc); gbc.gridx = 0; gbc.gridy = 1; gbc.gridwidth = 1; gbc.gridheight = 1; gbc.weighty = 0.1; gbc.fill = GridBagConstraints.HORIZONTAL; principal.add(new JScrollPane(cajaFicheros), gbc); gbc.gridx = 1; gbc.gridy = 3; gbc.gridwidth = 1; gbc.gridheight = 1; gbc.weighty = 0.1; gbc.fill = GridBagConstraints.NONE; principal.add(mostrar, gbc); gbc.gridx = 0; gbc.gridy = 4; gbc.gridwidth = 1; gbc.gridheight = 1; gbc.weighty = 0.1; gbc.fill = GridBagConstraints.NONE; principal.add(atras, gbc); gbc.gridx = 1; gbc.gridy = 4; gbc.gridwidth = 1; gbc.gridheight = 1; gbc.weighty = 0.1; gbc.fill = GridBagConstraints.NONE; principal.add(salir, gbc); //cajaFicheros.setEditable(false); //Hace visible el panel principal.setVisible(true); principal.setSize(650, 350); principal.setLocationRelativeTo(null); principal.setResizable(false); //principal.pack(); mostrar.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { String ftpSsrver = "127.0.0.1"; String ftpUser = "solera"; String ftpPass = "solera"; FTPClient cFtp = new FTPClient(); try { cFtp.connect(ftpSsrver); boolean login = cFtp.login(ftpUser, ftpPass); System.out.print("conexion ftp para ver ficheros establecida"); cFtp.enterLocalPassiveMode(); String[] archivos = cFtp.listNames(); FTPFile[] detalles = cFtp.listFiles(); archivos = cFtp.listNames(); for (int i = 0; i < archivos.length; i++) { /* cajaFicheros.selectAll(); cajaFicheros.replaceSelection(""); */ arrayArchivos.add(archivos[i].toString()); System.out.println(arrayArchivos.get(i)); cajaFicheros.append(System.getProperty("line.separator")); cajaFicheros.append(arrayArchivos.get(i)); } cFtp.logout(); cFtp.disconnect(); System.out.println("Conexion Finalizada, buenas tardes."); } catch (IOException ioe) { System.out.println("error" + ioe.toString()); } } }); try { salir.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { System.exit(0); } }); } catch (Exception e) { } try { atras.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { FormularioAccesoFtp accesoFtp = new FormularioAccesoFtp(); accesoFtp.inicioFtp(); principal.setVisible(false); } }); } catch (Exception e) { } }
From source file:nz.govt.natlib.ndha.manualdeposit.metadata.PersonalSettings.java
public void setStandardFont(final Font value) { fontName = value.getFontName(); fontSize = value.getSize();/*from w w w .ja va2 s .co m*/ fontBold = value.isBold(); fontItalic = value.isItalic(); fontPlain = value.isPlain(); saveData(); }
From source file:TrabajoFinalJava.DescargaFichero.java
@Override public void run() { //************************INICIO****INTERFAZ************************************************************************** JFrame principal = new JFrame("GESTOR DESCARGAS"); //Colores//from w ww. j a va 2s . c om Color nuevoColor = new Color(167, 220, 231); principal.getContentPane().setBackground(nuevoColor); JLabel tituloPrincipal = new JLabel("GESTOR DESCARGAS"); JLabel tituloVentana = new JLabel("DESCARGA FICHERO FTP"); //Recojo la fuente que se esta utilizando actualmente. Font auxFont = tituloPrincipal.getFont(); //Aplico la fuente actual, y al final le doy el tamao del texto... tituloPrincipal.setFont(new Font(auxFont.getFontName(), auxFont.getStyle(), 30)); tituloVentana.setFont(new Font(auxFont.getFontName(), auxFont.getStyle(), 30)); //tituloVentana.setAlignmentY(0); JLabel nombreArchivo = new JLabel("INTRODUCE EL NOMBRE DEL FICHERO A DESCARGAR."); JTextField nombreArchivoIn = new JTextField(); JButton descarga = new JButton("DESCARGA FICHERO."); JButton atras = new JButton("ATRAS"); JButton salir = new JButton("Salir"); GridBagLayout gridbag = new GridBagLayout(); GridBagConstraints gbc = new GridBagConstraints(); //Asignamos la constante EXIT_ON_CLOSE, cierra la ventana al pulsar la X. principal.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); //Asignamos al JFrame el Layout que usaremos, GridBagLayout principal.setLayout(gridbag); //aadir botones al layout gbc.gridx = 1; gbc.gridy = 0; gbc.gridwidth = 1; gbc.gridheight = 1; gbc.weighty = 0.1; // La fila 0 debe estirarse, le ponemos un 1.0 gbc.fill = GridBagConstraints.HORIZONTAL; principal.add(tituloPrincipal, gbc); gbc.gridx = 1; gbc.gridy = 1; gbc.gridwidth = 1; gbc.gridheight = 1; gbc.weighty = 0.1; // La fila 0 debe estirarse, le ponemos un 1.0 gbc.fill = GridBagConstraints.NONE; principal.add(tituloVentana, gbc); gbc.gridx = 1; gbc.gridy = 2; gbc.gridwidth = 1; gbc.gridheight = 1; gbc.weighty = 0.0; gbc.fill = GridBagConstraints.HORIZONTAL; principal.add(nombreArchivo, gbc); gbc.gridx = 1; gbc.gridy = 3; gbc.gridwidth = 1; gbc.gridheight = 1; gbc.weighty = 0.0; gbc.fill = GridBagConstraints.HORIZONTAL; principal.add(nombreArchivoIn, gbc); gbc.gridx = 1; gbc.gridy = 4; gbc.gridwidth = 1; gbc.gridheight = 1; gbc.weighty = 0.0; gbc.fill = GridBagConstraints.NONE; principal.add(descarga, gbc); gbc.gridx = 0; gbc.gridy = 5; gbc.gridwidth = 1; gbc.gridheight = 1; gbc.weighty = 0.1; gbc.fill = GridBagConstraints.NONE; principal.add(atras, gbc); gbc.gridx = 1; gbc.gridy = 5; gbc.gridwidth = 1; gbc.gridheight = 1; gbc.weighty = 0.1; // La fila 0 debe estirarse, le ponemos un 1.0 gbc.fill = GridBagConstraints.HORIZONTAL; principal.add(salir, gbc); //Hace visible el panel principal.setVisible(true); principal.setSize(650, 350); principal.setLocationRelativeTo(null); principal.setResizable(false); //principal.pack(); descarga.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { if (descargasUsuarioLog <= 9) { try { cFtp.connect(ftpSsrver); boolean login = cFtp.login(ftpUser, ftpPass); System.out.print("conexion establecida"); cFtp.enterLocalPassiveMode(); nombreFichero = nombreArchivoIn.getText(); nombrePc = nombreArchivoIn.getText(); CrearListaFicheros listarFicheros = new CrearListaFicheros(); listarFicheros.start(); for (int i = 0; i < CrearListaFicheros.arrayArchivos.size(); i++) { System.out.println(CrearListaFicheros.arrayArchivos.get(i)); } if (CrearListaFicheros.arrayArchivos.contains(nombreFichero)) { FTPFile file = cFtp.mlistFile(nombreFichero); long size = file.getSize(); System.out.println("Tamao del fichero= " + size); if (size > 1000000) { System.out.println("El fichero es muy grande......"); } else { FileOutputStream fos = new FileOutputStream(nombreFichero); cFtp.retrieveFile(nombreFichero, fos); System.out.println(""); System.out.println("Archivo recibido"); nombreArchivoIn.setBackground(Color.green); descargasUsuarioLog = descargasUsuarioLog + 1; System.out.println(descargasUsuarioLog); //modificamos las descargas totales del usuario en la BBDD Connection conn; try { try { Class.forName("com.mysql.jdbc.Driver"); } catch (Exception y) { y.printStackTrace(); } conn = DriverManager.getConnection("jdbc:mysql://127.0.0.1:3306/midb", "root", ""); System.out.println("Conn OK!"); stmt = conn.createStatement(); stmt.executeUpdate("UPDATE usuarios SET bajadas = '" + descargasUsuarioLog + "' WHERE usuario = '" + usuarioLog + "';"); System.out.print("Descargas modificadas correctamente."); conn.close(); } catch (Exception i) { System.out.println(e); } } } else { System.out.println("El fichero no existe..."); nombreArchivoIn.setText("El fichero no existe"); } } catch (IOException r) { r.printStackTrace(); } } else { System.out.println( "No te quedan descargas... por favor comuniquese con el administrador del servidor. Gracias."); nombreArchivoIn.setText( "No te quedan descargas... por favor comuniquese con el administrador del servidor. Gracias."); } } }); atras.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { FormularioAccesoFtp accesoFtp = new FormularioAccesoFtp(); accesoFtp.inicioFtp(); principal.setVisible(false); } }); salir.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { System.exit(1000); } }); }
From source file:com.petersoft.advancedswing.enhancedtextarea.EnhancedTextArea.java
private void initGUI() { try {//from w ww . ja va2 s . c o m BorderLayout thisLayout = new BorderLayout(); this.setLayout(thisLayout); this.setPreferredSize(new java.awt.Dimension(725, 290)); { jToolBar = new JToolBar(); this.add(jToolBar, BorderLayout.NORTH); { jSaveButton = new JButton(); jToolBar.add(jSaveButton); jSaveButton.setText("Save"); jSaveButton.setIcon(new ImageIcon(getClass().getClassLoader() .getResource("com/petersoft/advancedswing/enhancedtextarea/disk.png"))); jSaveButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent evt) { jSaveButtonActionPerformed(evt); } }); } { jLineWrapButton = new JToggleButton(); jToolBar.add(jLineWrapButton); jLineWrapButton.setText("Wrap"); jLineWrapButton.setIcon(new ImageIcon(getClass().getClassLoader() .getResource("com/petersoft/advancedswing/enhancedtextarea/linewrap.png"))); jLineWrapButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent evt) { jLineWrapButtonActionPerformed(evt); } }); } { jFontBiggerButton = new JButton(); jToolBar.add(jFontBiggerButton); jFontBiggerButton.setIcon(new ImageIcon(getClass().getClassLoader() .getResource("com/petersoft/advancedswing/enhancedtextarea/font_add.png"))); jFontBiggerButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent evt) { jFontBiggerButtonActionPerformed(evt); } }); } { jFontSmallerButton = new JButton(); jToolBar.add(jFontSmallerButton); jFontSmallerButton.setIcon(new ImageIcon(getClass().getClassLoader() .getResource("com/petersoft/advancedswing/enhancedtextarea/font_delete.png"))); jFontSmallerButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent evt) { jFontSmallerButtonActionPerformed(evt); } }); } { jLabel1 = new JLabel(); jToolBar.add(jLabel1); jLabel1.setText(" "); } { jSearchTextField = new JSearchTextField(); jToolBar.add(jSearchTextField); jSearchTextField.setMaximumSize(new java.awt.Dimension(100, 22)); jSearchTextField.setPreferredSize(new java.awt.Dimension(100, 22)); jSearchTextField.setSize(new java.awt.Dimension(100, 22)); jSearchTextField.addKeyListener(new KeyAdapter() { public void keyReleased(KeyEvent evt) { jSearchTextFieldKeyReleased(evt); } }); } { jSeparatorLabel = new JLabel(); jToolBar.add(jSeparatorLabel); jSeparatorLabel.setText(" "); } { GraphicsEnvironment e = GraphicsEnvironment.getLocalGraphicsEnvironment(); Font[] fonts = e.getAllFonts(); String fontNames[] = new String[fonts.length]; int x = 0; for (Font f : fonts) { fontNames[x++] = f.getFontName(); } ComboBoxModel jFontComboBoxModel = new DefaultComboBoxModel(fontNames); jFontComboBox = new JComboBox(); jToolBar.add(jFontComboBox); jFontComboBox.setModel(jFontComboBoxModel); jFontComboBox.setMaximumSize(new java.awt.Dimension(180, 22)); jFontComboBox.setPreferredSize(new java.awt.Dimension(180, 22)); jFontComboBox.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent evt) { jFontComboBoxActionPerformed(evt); } }); } { pager = new Pager(); jToolBar.add(pager); pager.setVisible(false); } } { jScrollPane1 = new JScrollPane(); this.add(jScrollPane1, BorderLayout.CENTER); { jTextArea = new JTextArea(); jTextArea.getDocument().addDocumentListener(this); lines = new JTextArea(" 1 "); lines.setBackground(new Color(200, 230, 245)); lines.setEditable(false); jScrollPane1.setRowHeaderView(lines); jTextArea.getDocument().addDocumentListener(new DocumentListener() { public String getText() { int caretPosition = jTextArea.getDocument().getLength(); Element root = jTextArea.getDocument().getDefaultRootElement(); int base = 0; if (separateByLine == false) { if (str != null) { base = StringUtils.countMatches( str.substring(0, (pager.getPage() - 1) * pageSize), System.getProperty("line.separator")); if (base == 1) { base = 0; } } } else { base = (pager.getPage() - 1) * pageSize; } base += lineNoBase; String text = " " + (base + 1) + " " + System.getProperty("line.separator"); for (int i = 2; i < root.getElementIndex(caretPosition) + 2; i++) { text += " " + (base + i) + " " + System.getProperty("line.separator"); } return text; } @Override public void changedUpdate(DocumentEvent de) { lines.setText(getText()); } @Override public void insertUpdate(DocumentEvent de) { lines.setText(getText()); } @Override public void removeUpdate(DocumentEvent de) { lines.setText(getText()); } }); jScrollPane1.setViewportView(jTextArea); } } { jStatusPanel = new JPanel(); FlowLayout jStatusPanelLayout = new FlowLayout(); jStatusPanelLayout.setAlignment(FlowLayout.LEFT); jStatusPanel.setLayout(jStatusPanelLayout); this.add(jStatusPanel, BorderLayout.SOUTH); { jStatusLabel = new JLabel(); jStatusPanel.add(jStatusLabel); } { jSearchLabel = new JLabel(); jStatusPanel.add(jSearchLabel); } } this.jFontComboBox.setSelectedItem(jTextArea.getFont().getFamily() + ".plain"); } catch (Exception e) { e.printStackTrace(); } }
From source file:com.itemanalysis.jmetrik.gui.JmetrikPreferencesManager.java
public void setFont(Font f) { p.put(OUTPUT_FONT, f.getFontName()); p.putInt(OUTPUT_FONT_STYLE, f.getStyle()); p.putInt(OUTPUT_FONT_SIZE, f.getSize()); }
From source file:ca.sqlpower.architect.swingui.TestPlayPen.java
/** * Returns a new value that is not equal to oldVal. The * returned object will be a new instance compatible with oldVal. * /*from ww w. j a v a 2 s .c o m*/ * @param property The property that should be modified. * @param oldVal The existing value of the property to modify. The returned value * will not equal this one at the time this method was first called. */ private Object getNewDifferentValue(PropertyDescriptor property, Object oldVal) { Object newVal; // don't init here so compiler can warn if the // following code doesn't always give it a value if (property.getPropertyType() == String.class) { newVal = "new " + oldVal; } else if (property.getPropertyType() == Boolean.class || property.getPropertyType() == Boolean.TYPE) { if (oldVal == null) { newVal = new Boolean(false); } else { newVal = new Boolean(!((Boolean) oldVal).booleanValue()); } } else if (property.getPropertyType() == Double.class || property.getPropertyType() == Double.TYPE) { if (oldVal == null) { newVal = new Double(0); } else { newVal = new Double(((Double) oldVal).doubleValue() + 1); } } else if (property.getPropertyType() == Integer.class || property.getPropertyType() == Integer.TYPE) { if (oldVal == null) { newVal = new Integer(0); } else { newVal = new Integer(((Integer) oldVal).intValue() + 1); } } else if (property.getPropertyType() == Color.class) { if (oldVal == null) { newVal = new Color(0xFAC157); } else { Color oldColor = (Color) oldVal; newVal = new Color((oldColor.getRGB() + 0xF00) % 0x1000000); } } else if (property.getPropertyType() == Font.class) { if (oldVal == null) { newVal = FontManager.getDefaultPhysicalFont(); } else { Font oldFont = (Font) oldVal; newVal = new Font(oldFont.getFontName(), oldFont.getSize() + 2, oldFont.getStyle()); } } else if (property.getPropertyType() == Set.class) { newVal = new HashSet(); ((Set) newVal).add("test"); } else if (property.getPropertyType() == List.class) { newVal = new ArrayList(); ((List) newVal).add("test"); } else if (property.getPropertyType() == Point.class) { newVal = new Point(1, 3); } else { throw new RuntimeException("This test case lacks a value for " + property.getName() + " (type " + property.getPropertyType().getName() + ") in getNewDifferentValue()"); } return newVal; }
From source file:Gui.HistoryAdminGUINew.java
public void showStatHistory() { // method statGreensociety...... History int tempRepair = history.statGreensocietyRepair(); int tempBorrow = history.statGreensocietyBorrow(); int tempReturn = history.statGreensocietyReturn(); DefaultCategoryDataset barchartData = new DefaultCategoryDataset(); barchartData.setValue(tempRepair, "0", "RepairHistory"); barchartData.setValue(tempBorrow, "1", "BorrowHistory"); barchartData.setValue(tempReturn, "2", "ReturnHistory"); JFreeChart chart = ChartFactory.createBarChart("History Statictics", "History", "Times", barchartData, PlotOrientation.HORIZONTAL, false, true, false); // chart.getTitle().setPaint(Color.WHITE); //?? //--------SET FONT-------------- try {//from w w w .ja v a 2s .c o m File f = new File("leelawad.ttf"); Font customFont = Font.createFont(Font.TRUETYPE_FONT, f); customFont = customFont.deriveFont(16f); chart.getTitle().setFont(customFont); System.out.println(customFont.getFontName()); } catch (FileNotFoundException e) { e.printStackTrace(); } catch (FontFormatException | IOException e) { e.printStackTrace(); } //------------------------------ chart.setBackgroundPaint(new Color(19, 175, 248)); //setBackground ? CategoryPlot barchartPlot = chart.getCategoryPlot(); barchartPlot.setRangeGridlinePaint(Color.BLACK); //set ?? //Customize renderer BarRenderer renderer = (BarRenderer) barchartPlot.getRenderer(); java.awt.Paint paint1 = new Color(255, 0, 0); java.awt.Paint paint2 = new Color(0, 0, 255); java.awt.Paint paint3 = new Color(255, 255, 0); renderer.setSeriesPaint(0, paint1); //Color for RepairGraph renderer.setSeriesPaint(1, paint2); //Color for BorrowGraph renderer.setSeriesPaint(2, paint3); //Color for ReturnGraph ChartPanel barPanel = new ChartPanel(chart); jPanelShowGraph.removeAll(); jPanelShowGraph.add(barPanel, BorderLayout.CENTER); jPanelShowGraph.validate(); }