java文本框口中怎样设置自适应换行?
Posted
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了java文本框口中怎样设置自适应换行?相关的知识,希望对你有一定的参考价值。
JTextAreasetWrapStyleWord(boolean word)
设置换行方式(如果文本区要换行)。
setLineWrap(boolean wrap)
设置文本区的换行策略。
上边那个表示如果要换行,是否到词结束换。下边那个如果是true就换行,否则不换行 参考技术A new JTextArea().setLineWrap(boolean wrap);如果为true则换行。本回答被提问者采纳
自定义悬停框 Plotly:Python 以适应文本
【中文标题】自定义悬停框 Plotly:Python 以适应文本【英文标题】:Customize Hover Box Plotly: Python to Fit Text 【发布时间】:2015-06-09 20:06:29 【问题描述】:有没有办法在 plotly 中自定义悬停文本框?我必须在悬停框中显示的文本很长,不适合屏幕。有没有办法改变悬停文本框的尺寸或缩小文本以使其全部适合屏幕。 更好的是图表侧面的固定框,当我滚动该数据点时显示相应的注释,但我不知道该怎么做。
这是我尝试使用一些类似长度的文本的示例。
import plotly.plotly as py
from plotly.graph_objs import *
import plotly
import matplotlib.pyplot as plt
import numpy as np
import pandas as pd
notes=["Clinton is also navigating delicate ties with Israel and the American Jewish community, an influential group of voters and donors. Israeli Prime Minister Benjamin Netanyahu, a fierce critic of the Obama administration's outreach to Iran, described the framework deal as a threat to the very survival of his nation.", "Fire crews in Cambria County were called to the Revloc duplex Friday morning and found much of the building engulfed in flames. Chief Deputy Coroner Jeffrey Leeds said at least seven people were in the duplex and all, but one, were able to get out safely.Witnesses said Jake Lewis, 24, re-entered the house to rescue 65-year-old Anna LaJudice. But father, Robert LaJudice, told The (Altoona) Mirror.Their bodies were later recovered. The deputy coroner said autopsies determined that both died from smoke and gas inhalation.", "As crews worked to tear down the rest of the home, Ott said she planned to attend a church service and say a prayer for the family."]
balance=[1000,2000,4000]
dates=[1,2,3]
data1 = Data([
Scatter(
x=dates,
y=balance,
mode='markers',
text=notes,
)
])
layout = Layout(
title='Hover over the points to see the text',autosize=True,
)
fig = Figure(data=data1, layout=layout,)
fig['layout'].update(
hovermode='closest',
showlegend=False,
autosize=True,
)
plot_url = py.plot(fig, filename='hover-chart-basic')
py.plot(fig, filename='hover-chart-basic')
任何帮助将不胜感激!
【问题讨论】:
【参考方案1】:您可能需要查看注释以创建固定文本框。在此处查看我们的文档:https://plot.ly/python/text-and-annotations/ 您将了解如何为注释或悬停文本指定字体大小。
【讨论】:
【参考方案2】:秘诀是在悬停字符串文本中每隔约 90 个字符插入一个 html 标签。您可以使用下面的正则表达式来匹配每 ~90 行。
(.1,90)(\\s|$)
【讨论】:
以上是关于java文本框口中怎样设置自适应换行?的主要内容,如果未能解决你的问题,请参考以下文章