में टेक्स्ट का आकार कैसे बदलें मैंने देखा है कि फ़ोटोशॉप टेक्स्ट में उन्हें आसानी से आकार देकर आसानी से बदला जा सकता है। जावा में हम वही काम कैसे कर सकते हैं? जावा में पाठ का आकार बदलने के बारे में कोई विचार? पत्र का एक स्नैपशॉट 'ए' में फ़ोटोशॉप आकार दिया गयाजावा
कृपया मुझे पता है कि इस कोड के साथ गलत कौन है?
public class ResizeImage extends JFrame {
public ResizeImage(){
JPanel panel = new JPanel(){
public void paintComponent(Graphics g) {
// In your paint(Graphics g) method
// Create a buffered image for use as text layer
BufferedImage textLayer = new BufferedImage(240, 240,
BufferedImage.TYPE_INT_RGB);
// Get the graphics instance of the buffered image
Graphics2D gBuffImg = textLayer.createGraphics();
// Draw the string
gBuffImg.drawString("Hello World", 10, 10);
// Rescale the string the way you want it
gBuffImg.scale(200, 50);
// Draw the buffered image on the output's graphics object
g.drawImage(textLayer, 0, 0, null);
gBuffImg.dispose();
}
};
add(panel);
}
public static void main(String [] args){
ResizeImage frame = new ResizeImage();
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
frame.setSize(300, 300);
frame.setVisible(true);
}
}
आप 'बुफर्ड इमेज' पर फ़ॉन्ट प्रस्तुत कर सकते हैं और फिर इसे जिस तरह से चाहते हैं उसका आकार बदल सकते हैं। – Spoike
क्या यह समय के बारे में नहीं है *** आपने *** इस पर एक उत्तर स्वीकार किया है या समझाया है कि प्रस्तावित उत्तर उपयुक्त क्यों नहीं थे? –