@Override public void paint(Graphics g, JComponent c) { hasFocus = comboBox.hasFocus(); Graphics2D g2 = (Graphics2D) g; g2.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON); int w = c.getWidth(); int h = c.getHeight(); Image increase = new ImageIcon("img/comboboxback.png").getImage(); g2.drawImage(increase, 0, 0, 7, h, 0, 0, 7, 27, null); g2.drawImage(increase, 7, 0, w - 21, h, 7, 0, 97, 27, null); g2.drawImage(increase, w - 21, 0, w, h, 97, 0, 118, 27, null); if (!comboBox.isEditable()) { int x = (int) myComboBox.getLocation().getX(); int y = (int) myComboBox.getLocation().getY(); g2.setFont(new Font("黑体", Font.PLAIN, 15)); g2.drawString(myComboBox.getSelectedItem() + "", 5, 18); } }