我有以下问题:如果此文本在一行中,可以将文本的一部分沿右边缘对齐,另一部分沿左对齐吗?
现在,我将尝试解释得更清楚。我有这个窗口:
我可以在右边对齐接收时间吗?现在,我通过常规制表来分隔时间。这是该方法的代码:
frame.getSubscribe().addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
sTopic = frame.getTopicValue();
try {
if (mqttClient.isConnected()) {
mqttClient.subscribe(sTopic);
MqttCallback callback = new MqttCallback() {
@Override
public void connectionLost(Throwable throwable) {
}
@Override
public void messageArrived(String s, MqttMessage mqttMessage) throws Exception {
Date date = new Date();
String sDate = date.getHours()+":"+date.getMinutes()+":"+date.getSeconds();
frame.getTextArea().append(String.valueOf(mqttMessage)+"\t\t"+sDate+'\n');
}
@Override
public void deliveryComplete(IMqttDeliveryToken iMqttDeliveryToken) {
}
};
mqttClient.setCallback(callback);
}
} catch (MqttException e1) {
e1.printStackTrace();
}
System.out.println("Subscribed");
}
});