假设我有一个字符串,"Hello World".我想将此字符串的样式更改为BOLD字体,并将所有字符的大小设置为12到18 [pt].之后我想在JLabel和中使用这个字符串JButton.我怎样才能做到这一点?
我在java中为串口发送和接收数据做了简单的程序.我将串口设备连接到环回测试(Rx到Tx).它工作正常.但我无法发送和接收十六进制数据到串口和recive串口.在我的设备中使用了FT232BL芯片.所以有任何dll或其他库需要发送和接收十六进制数据到串口设备.我的代码如下.
enter code here
package x.rayimagecapture;
import gnu.io.CommPort;
import gnu.io.CommPortIdentifier;
import gnu.io.SerialPort;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.util.logging.Level;
import java.util.logging.Logger;
import javax.swing.JFrame;
import javax.swing.JPanel;
import javax.swing.Timer;
public class TwoWaySerialComm extends JPanel implements ActionListener {
OutputStream out;
private javax.swing.JButton btn;
private javax.swing.JScrollPane jScrollPane1;
public static javax.swing.JLabel jLabel1;
public static javax.swing.JTextField textField;
public static boolean flag = false;
public static int count = 50;
// TimerWindow tmr=new TimerWindow();
public static Timer tmr = new Timer(1000, new …Run Code Online (Sandbox Code Playgroud) 我正在使用Java技术在netbeans平台上制作桌面应用程序.我做了一些图像处理,数据库功能,图像捕获过程; 但现在我想在3D视图中绘制图像.
所以,我认为首先我必须制作我的.tiff 16位灰度图像的点阵,然后使用这个点阵.我试了一下,我的代码在下面,但它不起作用.
那么我应该如何使用这个点数组在3D视图中绘制我的图像呢?
import java.awt.BorderLayout;
import com.sun.j3d.utils.universe.*;
import java.awt.image.BufferedImage;
import javax.media.j3d.*;
import javax.media.jai.JAI;
import javax.media.jai.PlanarImage;
import javax.swing.JFrame;
import javax.swing.JPanel;
import javax.swing.JScrollPane;
import javax.vecmath.Color3f;
import javax.vecmath.Point3f;
public final class HelloJava3Da extends JPanel {
PlanarImage plImg3 = JAI.create("fileload", "C:\\Users\\Desktop\\myImage.tiff");
BufferedImage histImage = plImg3.getAsBufferedImage();
int s = 0, count = 0;
public HelloJava3Da() {
setLayout(new BorderLayout());
Canvas3D canvas3D = new Canvas3D(null);
add("Center", canvas3D);
BranchGroup scene = createSceneGraph();
scene.compile();
// SimpleUniverse is a Convenience Utility class
SimpleUniverse simpleU = new SimpleUniverse(canvas3D);
// …Run Code Online (Sandbox Code Playgroud) 我有一个存储为像素值数组的图像。我希望能够对此图像应用亮度或对比度滤镜。有什么简单的方法或算法可用来实现这一目标。
这是我的代码...
PlanarImage img=JAI.create("fileload","C:\\aimages\\blue_water.jpg");
BufferedImage image = img.getAsBufferedImage();
int w = image.getWidth();
int h = image.getHeight();
int k = 0;
int[] sbins = new int[256];
int[] pixel = new int[3];
Double d = 0.0;
Double d1;
for (int x = 0; x < bi.getWidth(); x++) {
for (int y = 0; y < bi.getHeight(); y++) {
pixel = bi.getRaster().getPixel(x, y, new int[3]);
k = (int) ((0.2125 * pixel[0]) + (0.7154 * pixel[1]) + (0.072 * pixel[2]));
sbins[k]++;
}
}
Run Code Online (Sandbox Code Playgroud) 我在java swing中使用netbeans plpatform制作桌面应用程序.当我在netbeans 7.0中运行我的应用程序时它运行良好.之后我安装了我的应用程序.然后我安装了我的应用程序安装程序,它工作得非常慢.当我的应用程序运行时netbeans IDE它最少消耗10mb,最大510mb.但是在安装之后,netbeans IDE中的安装程序默认只有24mb最小和最大64mb,或者当我使用netbeans IDE安装我的应用程序时,它只能获得最少24mb和最大64mb.那么如何增加我的应用程序的堆内存或我的应用程序安装程序的堆内存?
我有Arm处理器,它是AllWinner A13,RAM-512mb和OS-Linaro 13.01 Ubuntu(意思是debian).现在我正在为/ dev/ttyS0制作串行通信程序.我使用netbeans在java中为双向串行通信制作了简单的程序.在我的处理器中,我将ttyS0的rx-tx缩短为环回连接检查.意味着我通过串口发送的东西,我回来了.但我得到错误.我在我的处理器上安装了openjdk-7,librxtx-java.我的代码和错误如下.如果有任何想法或解决方案,请告诉我.
package serialcomm_linaro;
import gnu.io.CommPort;
import gnu.io.CommPortIdentifier;
import gnu.io.SerialPort;
import java.io.FileDescriptor;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
public class TwoWaySerialComm
{
public TwoWaySerialComm()
{
super();
}
void connect ( String portName ) throws Exception
{
CommPortIdentifier portIdentifier = CommPortIdentifier.getPortIdentifier(portName);
if ( portIdentifier.isCurrentlyOwned() )
{
System.out.println("Error: Port is currently in use");
}
else
{
CommPort commPort = portIdentifier.open(this.getClass().getName(),2000);
if ( commPort instanceof SerialPort )
{
SerialPort serialPort = (SerialPort) commPort;
serialPort.setSerialPortParams(115200,SerialPort.DATABITS_8,SerialPort.STOPBITS_1,SerialPort.PARITY_NONE);
InputStream in = serialPort.getInputStream();
OutputStream out …Run Code Online (Sandbox Code Playgroud) 你好先生/ mem即时制作桌面应用程序在java Swing for doctor.I想要找到每个像素值不计算在两个点之间.假设我有一个点(100,145)和第二个点是(173,190),我想得到这个之间的像素两点.表示两点之间的(x,y)值的每个像素.那我怎么能这样做?
我正在使用JFreeChart在java中使用netbeans绘制Running或Moving Sine Wave.我为它编写代码,但它不喜欢移动或运行正弦波图.所以,如果您对此有任何想法,那么建议我.我的代码如下
import java.awt.BorderLayout;
import java.awt.Color;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import javax.swing.JButton;
import javax.swing.JPanel;
import org.jfree.chart.ChartFactory;
import org.jfree.chart.ChartPanel;
import org.jfree.chart.JFreeChart;
import org.jfree.chart.plot.PlotOrientation;
import org.jfree.chart.plot.XYPlot;
import org.jfree.data.xy.XYDataset;
import org.jfree.data.xy.XYSeries;
import org.jfree.data.xy.XYSeriesCollection;
import org.jfree.ui.ApplicationFrame;
public class DrawChart extends ApplicationFrame implements ActionListener {
public XYSeries series;
public DrawChart(final String title) {
super(title);
series = new XYSeries("Sine", true, true);
XYSeriesCollection dataset = new XYSeriesCollection(series);
final JFreeChart chart = createChart(dataset);
final ChartPanel chartPanel = new ChartPanel(chart);
final JButton button = new JButton("Add New Data …Run Code Online (Sandbox Code Playgroud) 我在java.now的netbeans平台上制作了桌面应用程序.当我运行我的应用程序时,它将打开默认大小的netbeans平台配置.但是当我运行或启动我的应用程序时我想要全屏模式.那么我的应用程序在哪里以及如何做到这一点?
java ×9
netbeans ×2
platform ×2
animation ×1
awt ×1
fonts ×1
heap-memory ×1
hex ×1
java-3d ×1
jfreechart ×1
pixels ×1
rxtx ×1
serial-port ×1
swing ×1